home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume9 / xterm / part02 < prev    next >
Encoding:
Internet Message Format  |  1987-04-19  |  62.3 KB

  1. Subject:  v09i055:  Terminal emulator for X window system, Part02/07
  2. Newsgroups: mod.sources
  3. Approved: rs@mirror.TMC.COM
  4.  
  5. Submitted by: edmoy@opal.Berkeley.EDU
  6. Mod.sources: Volume 9, Issue 55
  7. Archive-name: xterm6.6b/Part02
  8.  
  9. #! /bin/sh
  10. # This is a shell archive, meaning:
  11. # 1. Remove everything above the #! /bin/sh line.
  12. # 2. Save the resulting text in a file.
  13. # 3. Execute the file with /bin/sh (not csh) to create the files:
  14. #    Tekparsetable.c Tekproc.c main.h
  15. if test -f Tekparsetable.c
  16. then
  17.     echo shar: will not overwrite existing file "'Tekparsetable.c'"
  18. else
  19. echo 'x - Tekparsetable.c'
  20. cat << \RAZZLE!DAZZLE > Tekparsetable.c
  21. /*
  22.  *    $Source: /u1/X/xterm/RCS/Tekparsetable.c,v $
  23.  *    $Header: Tekparsetable.c,v 10.101 86/12/01 21:50:13 jg Rel $
  24.  */
  25.  
  26. #ifndef lint
  27. static char *rcsid_Tekparsetable_c = "$Header: Tekparsetable.c,v 10.101 86/12/01 21:50:13 jg Rel $";
  28. #endif    lint
  29.  
  30. #include "Tekparse.h"
  31. #ifndef lint
  32. static char sccs_id[] = "@(#)Tekparsetable.c\tX10/6.6B\t12/26/86";
  33. #endif    lint
  34.  
  35. int Talptable[] = {
  36. /*    NUL        SOH        STX        ETX    */
  37. CASE_IGNORE,
  38. CASE_IGNORE,
  39. CASE_IGNORE,
  40. CASE_IGNORE,
  41. /*    EOT        ENQ        ACK        BEL    */
  42. CASE_IGNORE,
  43. CASE_IGNORE,
  44. CASE_IGNORE,
  45. CASE_BEL,
  46. /*    BS        HT        NL        VT    */
  47. CASE_BS,
  48. CASE_TAB,
  49. CASE_LF,
  50. CASE_UP,
  51. /*    NP        CR        SO        SI    */
  52. CASE_IGNORE,
  53. CASE_CR,
  54. CASE_IGNORE,
  55. CASE_IGNORE,
  56. /*    DLE        DC1        DC2        DC3    */
  57. CASE_IGNORE,
  58. CASE_IGNORE,
  59. CASE_IGNORE,
  60. CASE_IGNORE,
  61. /*    DC4        NAK        SYN        ETB    */
  62. CASE_IGNORE,
  63. CASE_IGNORE,
  64. CASE_IGNORE,
  65. CASE_IGNORE,
  66. /*    CAN        EM        SUB        ESC    */
  67. CASE_IGNORE,
  68. CASE_IGNORE,
  69. CASE_IGNORE,
  70. CASE_ESC_STATE,
  71. /*    FS        GS        RS        US    */
  72. CASE_PT_STATE,
  73. CASE_PLT_STATE,
  74. CASE_IPL_STATE,
  75. CASE_ALP_STATE,
  76. /*    SP        !        "        #    */
  77. CASE_SP,
  78. CASE_PRINT,
  79. CASE_PRINT,
  80. CASE_PRINT,
  81. /*    $        %        &        '    */
  82. CASE_PRINT,
  83. CASE_PRINT,
  84. CASE_PRINT,
  85. CASE_PRINT,
  86. /*    (        )        *        +    */
  87. CASE_PRINT,
  88. CASE_PRINT,
  89. CASE_PRINT,
  90. CASE_PRINT,
  91. /*    ,        -        .        /    */
  92. CASE_PRINT,
  93. CASE_PRINT,
  94. CASE_PRINT,
  95. CASE_PRINT,
  96. /*    0        1        2        3    */
  97. CASE_PRINT,
  98. CASE_PRINT,
  99. CASE_PRINT,
  100. CASE_PRINT,
  101. /*    4        5        6        7    */
  102. CASE_PRINT,
  103. CASE_PRINT,
  104. CASE_PRINT,
  105. CASE_PRINT,
  106. /*    8        9        :        ;    */
  107. CASE_PRINT,
  108. CASE_PRINT,
  109. CASE_PRINT,
  110. CASE_PRINT,
  111. /*    <        =        >        ?    */
  112. CASE_PRINT,
  113. CASE_PRINT,
  114. CASE_PRINT,
  115. CASE_PRINT,
  116. /*    @        A        B        C    */
  117. CASE_PRINT,
  118. CASE_PRINT,
  119. CASE_PRINT,
  120. CASE_PRINT,
  121. /*    D        E        F        G    */
  122. CASE_PRINT,
  123. CASE_PRINT,
  124. CASE_PRINT,
  125. CASE_PRINT,
  126. /*    H        I        J        K    */
  127. CASE_PRINT,
  128. CASE_PRINT,
  129. CASE_PRINT,
  130. CASE_PRINT,
  131. /*    L        M        N        O    */
  132. CASE_PRINT,
  133. CASE_PRINT,
  134. CASE_PRINT,
  135. CASE_PRINT,
  136. /*    P        Q        R        S    */
  137. CASE_PRINT,
  138. CASE_PRINT,
  139. CASE_PRINT,
  140. CASE_PRINT,
  141. /*    T        U        V        W    */
  142. CASE_PRINT,
  143. CASE_PRINT,
  144. CASE_PRINT,
  145. CASE_PRINT,
  146. /*    X        Y        Z        [    */
  147. CASE_PRINT,
  148. CASE_PRINT,
  149. CASE_PRINT,
  150. CASE_PRINT,
  151. /*    \        ]        ^        _    */
  152. CASE_PRINT,
  153. CASE_PRINT,
  154. CASE_PRINT,
  155. CASE_PRINT,
  156. /*    `        a        b        c    */
  157. CASE_PRINT,
  158. CASE_PRINT,
  159. CASE_PRINT,
  160. CASE_PRINT,
  161. /*    d        e        f        g    */
  162. CASE_PRINT,
  163. CASE_PRINT,
  164. CASE_PRINT,
  165. CASE_PRINT,
  166. /*    h        i        j        k    */
  167. CASE_PRINT,
  168. CASE_PRINT,
  169. CASE_PRINT,
  170. CASE_PRINT,
  171. /*    l        m        n        o    */
  172. CASE_PRINT,
  173. CASE_PRINT,
  174. CASE_PRINT,
  175. CASE_PRINT,
  176. /*    p        q        r        s    */
  177. CASE_PRINT,
  178. CASE_PRINT,
  179. CASE_PRINT,
  180. CASE_PRINT,
  181. /*    t        u        v        w    */
  182. CASE_PRINT,
  183. CASE_PRINT,
  184. CASE_PRINT,
  185. CASE_PRINT,
  186. /*    x        y        z        {    */
  187. CASE_PRINT,
  188. CASE_PRINT,
  189. CASE_PRINT,
  190. CASE_PRINT,
  191. /*    |        }        ~        DEL    */
  192. CASE_PRINT,
  193. CASE_PRINT,
  194. CASE_PRINT,
  195. CASE_IGNORE,
  196. };
  197.  
  198. int Tbestable[] = {
  199. /*    NUL        SOH        STX        ETX    */
  200. CASE_BYP_STATE,
  201. CASE_BYP_STATE,
  202. CASE_BYP_STATE,
  203. CASE_VT_MODE,
  204. /*    EOT        ENQ        ACK        BEL    */
  205. CASE_BYP_STATE,
  206. CASE_REPORT,
  207. CASE_BYP_STATE,
  208. CASE_BEL,
  209. /*    BS        HT        NL        VT    */
  210. CASE_BS,
  211. CASE_TAB,
  212. CASE_IGNORE,
  213. CASE_UP,
  214. /*    NP        CR        SO        SI    */
  215. CASE_PAGE,
  216. CASE_IGNORE,
  217. CASE_BYP_STATE,
  218. CASE_BYP_STATE,
  219. /*    DLE        DC1        DC2        DC3    */
  220. CASE_BYP_STATE,
  221. CASE_BYP_STATE,
  222. CASE_BYP_STATE,
  223. CASE_BYP_STATE,
  224. /*    DC4        NAK        SYN        ETB    */
  225. CASE_BYP_STATE,
  226. CASE_BYP_STATE,
  227. CASE_BYP_STATE,
  228. CASE_COPY,
  229. /*    CAN        EM        SUB        ESC    */
  230. CASE_BYP_STATE,
  231. CASE_BYP_STATE,
  232. CASE_GIN,
  233. CASE_IGNORE,
  234. /*    FS        GS        RS        US    */
  235. CASE_SPT_STATE,
  236. CASE_PLT_STATE,
  237. CASE_IPL_STATE,
  238. CASE_ALP_STATE,
  239. /*    SP        !        "        #    */
  240. CASE_BYP_STATE,
  241. CASE_BYP_STATE,
  242. CASE_BYP_STATE,
  243. CASE_BYP_STATE,
  244. /*    $        %        &        '    */
  245. CASE_BYP_STATE,
  246. CASE_BYP_STATE,
  247. CASE_BYP_STATE,
  248. CASE_BYP_STATE,
  249. /*    (        )        *        +    */
  250. CASE_BYP_STATE,
  251. CASE_BYP_STATE,
  252. CASE_BYP_STATE,
  253. CASE_BYP_STATE,
  254. /*    ,        -        .        /    */
  255. CASE_BYP_STATE,
  256. CASE_BYP_STATE,
  257. CASE_BYP_STATE,
  258. CASE_BYP_STATE,
  259. /*    0        1        2        3    */
  260. CASE_BYP_STATE,
  261. CASE_BYP_STATE,
  262. CASE_BYP_STATE,
  263. CASE_BYP_STATE,
  264. /*    4        5        6        7    */
  265. CASE_BYP_STATE,
  266. CASE_BYP_STATE,
  267. CASE_BYP_STATE,
  268. CASE_BYP_STATE,
  269. /*    8        9        :        ;    */
  270. CASE_BYP_STATE,
  271. CASE_BYP_STATE,
  272. CASE_BYP_STATE,
  273. CASE_BYP_STATE,
  274. /*    <        =        >        ?    */
  275. CASE_BYP_STATE,
  276. CASE_BYP_STATE,
  277. CASE_BYP_STATE,
  278. CASE_BYP_STATE,
  279. /*    @        A        B        C    */
  280. CASE_BYP_STATE,
  281. CASE_BYP_STATE,
  282. CASE_BYP_STATE,
  283. CASE_BYP_STATE,
  284. /*    D        E        F        G    */
  285. CASE_BYP_STATE,
  286. CASE_BYP_STATE,
  287. CASE_BYP_STATE,
  288. CASE_BYP_STATE,
  289. /*    H        I        J        K    */
  290. CASE_BYP_STATE,
  291. CASE_BYP_STATE,
  292. CASE_BYP_STATE,
  293. CASE_BYP_STATE,
  294. /*    L        M        N        O    */
  295. CASE_BYP_STATE,
  296. CASE_BYP_STATE,
  297. CASE_BYP_STATE,
  298. CASE_BYP_STATE,
  299. /*    P        Q        R        S    */
  300. CASE_BYP_STATE,
  301. CASE_BYP_STATE,
  302. CASE_BYP_STATE,
  303. CASE_BYP_STATE,
  304. /*    T        U        V        W    */
  305. CASE_BYP_STATE,
  306. CASE_BYP_STATE,
  307. CASE_BYP_STATE,
  308. CASE_BYP_STATE,
  309. /*    X        Y        Z        [    */
  310. CASE_BYP_STATE,
  311. CASE_BYP_STATE,
  312. CASE_BYP_STATE,
  313. CASE_BYP_STATE,
  314. /*    \        ]        ^        _    */
  315. CASE_BYP_STATE,
  316. CASE_BYP_STATE,
  317. CASE_BYP_STATE,
  318. CASE_BYP_STATE,
  319. /*    `        a        b        c    */
  320. CASE_BYP_STATE,
  321. CASE_BYP_STATE,
  322. CASE_BYP_STATE,
  323. CASE_BYP_STATE,
  324. /*    d        e        f        g    */
  325. CASE_BYP_STATE,
  326. CASE_BYP_STATE,
  327. CASE_BYP_STATE,
  328. CASE_BYP_STATE,
  329. /*    h        i        j        k    */
  330. CASE_BYP_STATE,
  331. CASE_BYP_STATE,
  332. CASE_BYP_STATE,
  333. CASE_BYP_STATE,
  334. /*    l        m        n        o    */
  335. CASE_BYP_STATE,
  336. CASE_BYP_STATE,
  337. CASE_BYP_STATE,
  338. CASE_BYP_STATE,
  339. /*    p        q        r        s    */
  340. CASE_BYP_STATE,
  341. CASE_BYP_STATE,
  342. CASE_BYP_STATE,
  343. CASE_BYP_STATE,
  344. /*    t        u        v        w    */
  345. CASE_BYP_STATE,
  346. CASE_BYP_STATE,
  347. CASE_BYP_STATE,
  348. CASE_BYP_STATE,
  349. /*    x        y        z        {    */
  350. CASE_BYP_STATE,
  351. CASE_BYP_STATE,
  352. CASE_BYP_STATE,
  353. CASE_BYP_STATE,
  354. /*    |        }        ~        DEL    */
  355. CASE_BYP_STATE,
  356. CASE_BYP_STATE,
  357. CASE_IGNORE,
  358. CASE_BYP_STATE,
  359. };
  360.  
  361. int Tbyptable[] = {
  362. /*    NUL        SOH        STX        ETX    */
  363. CASE_IGNORE,
  364. CASE_IGNORE,
  365. CASE_IGNORE,
  366. CASE_IGNORE,
  367. /*    EOT        ENQ        ACK        BEL    */
  368. CASE_IGNORE,
  369. CASE_IGNORE,
  370. CASE_IGNORE,
  371. CASE_BEL,
  372. /*    BS        HT        NL        VT    */
  373. CASE_BS,
  374. CASE_TAB,
  375. CASE_LF,
  376. CASE_UP,
  377. /*    NP        CR        SO        SI    */
  378. CASE_IGNORE,
  379. CASE_CR,
  380. CASE_IGNORE,
  381. CASE_IGNORE,
  382. /*    DLE        DC1        DC2        DC3    */
  383. CASE_IGNORE,
  384. CASE_IGNORE,
  385. CASE_IGNORE,
  386. CASE_IGNORE,
  387. /*    DC4        NAK        SYN        ETB    */
  388. CASE_IGNORE,
  389. CASE_IGNORE,
  390. CASE_IGNORE,
  391. CASE_IGNORE,
  392. /*    CAN        EM        SUB        ESC    */
  393. CASE_IGNORE,
  394. CASE_IGNORE,
  395. CASE_IGNORE,
  396. CASE_BES_STATE,
  397. /*    FS        GS        RS        US    */
  398. CASE_PT_STATE,
  399. CASE_PLT_STATE,
  400. CASE_IPL_STATE,
  401. CASE_ALP_STATE,
  402. /*    SP        !        "        #    */
  403. CASE_IGNORE,
  404. CASE_IGNORE,
  405. CASE_IGNORE,
  406. CASE_IGNORE,
  407. /*    $        %        &        '    */
  408. CASE_IGNORE,
  409. CASE_IGNORE,
  410. CASE_IGNORE,
  411. CASE_IGNORE,
  412. /*    (        )        *        +    */
  413. CASE_IGNORE,
  414. CASE_IGNORE,
  415. CASE_IGNORE,
  416. CASE_IGNORE,
  417. /*    ,        -        .        /    */
  418. CASE_IGNORE,
  419. CASE_IGNORE,
  420. CASE_IGNORE,
  421. CASE_IGNORE,
  422. /*    0        1        2        3    */
  423. CASE_IGNORE,
  424. CASE_IGNORE,
  425. CASE_IGNORE,
  426. CASE_IGNORE,
  427. /*    4        5        6        7    */
  428. CASE_IGNORE,
  429. CASE_IGNORE,
  430. CASE_IGNORE,
  431. CASE_IGNORE,
  432. /*    8        9        :        ;    */
  433. CASE_IGNORE,
  434. CASE_IGNORE,
  435. CASE_IGNORE,
  436. CASE_IGNORE,
  437. /*    <        =        >        ?    */
  438. CASE_IGNORE,
  439. CASE_IGNORE,
  440. CASE_IGNORE,
  441. CASE_IGNORE,
  442. /*    @        A        B        C    */
  443. CASE_IGNORE,
  444. CASE_IGNORE,
  445. CASE_IGNORE,
  446. CASE_IGNORE,
  447. /*    D        E        F        G    */
  448. CASE_IGNORE,
  449. CASE_IGNORE,
  450. CASE_IGNORE,
  451. CASE_IGNORE,
  452. /*    H        I        J        K    */
  453. CASE_IGNORE,
  454. CASE_IGNORE,
  455. CASE_IGNORE,
  456. CASE_IGNORE,
  457. /*    L        M        N        O    */
  458. CASE_IGNORE,
  459. CASE_IGNORE,
  460. CASE_IGNORE,
  461. CASE_IGNORE,
  462. /*    P        Q        R        S    */
  463. CASE_IGNORE,
  464. CASE_IGNORE,
  465. CASE_IGNORE,
  466. CASE_IGNORE,
  467. /*    T        U        V        W    */
  468. CASE_IGNORE,
  469. CASE_IGNORE,
  470. CASE_IGNORE,
  471. CASE_IGNORE,
  472. /*    X        Y        Z        [    */
  473. CASE_IGNORE,
  474. CASE_IGNORE,
  475. CASE_IGNORE,
  476. CASE_IGNORE,
  477. /*    \        ]        ^        _    */
  478. CASE_IGNORE,
  479. CASE_IGNORE,
  480. CASE_IGNORE,
  481. CASE_IGNORE,
  482. /*    `        a        b        c    */
  483. CASE_IGNORE,
  484. CASE_IGNORE,
  485. CASE_IGNORE,
  486. CASE_IGNORE,
  487. /*    d        e        f        g    */
  488. CASE_IGNORE,
  489. CASE_IGNORE,
  490. CASE_IGNORE,
  491. CASE_IGNORE,
  492. /*    h        i        j        k    */
  493. CASE_IGNORE,
  494. CASE_IGNORE,
  495. CASE_IGNORE,
  496. CASE_IGNORE,
  497. /*    l        m        n        o    */
  498. CASE_IGNORE,
  499. CASE_IGNORE,
  500. CASE_IGNORE,
  501. CASE_IGNORE,
  502. /*    p        q        r        s    */
  503. CASE_IGNORE,
  504. CASE_IGNORE,
  505. CASE_IGNORE,
  506. CASE_IGNORE,
  507. /*    t        u        v        w    */
  508. CASE_IGNORE,
  509. CASE_IGNORE,
  510. CASE_IGNORE,
  511. CASE_IGNORE,
  512. /*    x        y        z        {    */
  513. CASE_IGNORE,
  514. CASE_IGNORE,
  515. CASE_IGNORE,
  516. CASE_IGNORE,
  517. /*    |        }        ~        DEL    */
  518. CASE_IGNORE,
  519. CASE_IGNORE,
  520. CASE_IGNORE,
  521. CASE_IGNORE,
  522. };
  523.  
  524. int Tesctable[] = {
  525. /*    NUL        SOH        STX        ETX    */
  526. CASE_CURSTATE,
  527. CASE_CURSTATE,
  528. CASE_CURSTATE,
  529. CASE_VT_MODE,
  530. /*    EOT        ENQ        ACK        BEL    */
  531. CASE_CURSTATE,
  532. CASE_REPORT,
  533. CASE_CURSTATE,
  534. CASE_BEL,
  535. /*    BS        HT        NL        VT    */
  536. CASE_BS,
  537. CASE_TAB,
  538. CASE_IGNORE,
  539. CASE_UP,
  540. /*    NP        CR        SO        SI    */
  541. CASE_PAGE,
  542. CASE_IGNORE,
  543. CASE_APL,
  544. CASE_ASCII,
  545. /*    DLE        DC1        DC2        DC3    */
  546. CASE_CURSTATE,
  547. CASE_CURSTATE,
  548. CASE_CURSTATE,
  549. CASE_CURSTATE,
  550. /*    DC4        NAK        SYN        ETB    */
  551. CASE_CURSTATE,
  552. CASE_CURSTATE,
  553. CASE_CURSTATE,
  554. CASE_COPY,
  555. /*    CAN        EM        SUB        ESC    */
  556. CASE_BYP_STATE,
  557. CASE_CURSTATE,
  558. CASE_GIN,
  559. CASE_IGNORE,
  560. /*    FS        GS        RS        US    */
  561. CASE_SPT_STATE,
  562. CASE_PLT_STATE,
  563. CASE_IPL_STATE,
  564. CASE_ALP_STATE,
  565. /*    SP        !        "        #    */
  566. CASE_CURSTATE,
  567. CASE_CURSTATE,
  568. CASE_CURSTATE,
  569. CASE_CURSTATE,
  570. /*    $        %        &        '    */
  571. CASE_CURSTATE,
  572. CASE_CURSTATE,
  573. CASE_CURSTATE,
  574. CASE_CURSTATE,
  575. /*    (        )        *        +    */
  576. CASE_CURSTATE,
  577. CASE_CURSTATE,
  578. CASE_CURSTATE,
  579. CASE_CURSTATE,
  580. /*    ,        -        .        /    */
  581. CASE_CURSTATE,
  582. CASE_CURSTATE,
  583. CASE_CURSTATE,
  584. CASE_CURSTATE,
  585. /*    0        1        2        3    */
  586. CASE_CURSTATE,
  587. CASE_CURSTATE,
  588. CASE_CURSTATE,
  589. CASE_CURSTATE,
  590. /*    4        5        6        7    */
  591. CASE_CURSTATE,
  592. CASE_CURSTATE,
  593. CASE_CURSTATE,
  594. CASE_CURSTATE,
  595. /*    8        9        :        ;    */
  596. CASE_CHAR_SIZE,
  597. CASE_CHAR_SIZE,
  598. CASE_CHAR_SIZE,
  599. CASE_CHAR_SIZE,
  600. /*    <        =        >        ?    */
  601. CASE_CURSTATE,
  602. CASE_CURSTATE,
  603. CASE_CURSTATE,
  604. CASE_CURSTATE,
  605. /*    @        A        B        C    */
  606. CASE_CURSTATE,
  607. CASE_CURSTATE,
  608. CASE_CURSTATE,
  609. CASE_CURSTATE,
  610. /*    D        E        F        G    */
  611. CASE_CURSTATE,
  612. CASE_CURSTATE,
  613. CASE_CURSTATE,
  614. CASE_CURSTATE,
  615. /*    H        I        J        K    */
  616. CASE_CURSTATE,
  617. CASE_CURSTATE,
  618. CASE_CURSTATE,
  619. CASE_CURSTATE,
  620. /*    L        M        N        O    */
  621. CASE_CURSTATE,
  622. CASE_CURSTATE,
  623. CASE_CURSTATE,
  624. CASE_CURSTATE,
  625. /*    P        Q        R        S    */
  626. CASE_CURSTATE,
  627. CASE_CURSTATE,
  628. CASE_CURSTATE,
  629. CASE_CURSTATE,
  630. /*    T        U        V        W    */
  631. CASE_CURSTATE,
  632. CASE_CURSTATE,
  633. CASE_CURSTATE,
  634. CASE_CURSTATE,
  635. /*    X        Y        Z        [    */
  636. CASE_CURSTATE,
  637. CASE_CURSTATE,
  638. CASE_CURSTATE,
  639. CASE_CURSTATE,
  640. /*    \        ]        ^        _    */
  641. CASE_CURSTATE,
  642. CASE_OSC,
  643. CASE_CURSTATE,
  644. CASE_CURSTATE,
  645. /*    `        a        b        c    */
  646. CASE_BEAM_VEC,
  647. CASE_BEAM_VEC,
  648. CASE_BEAM_VEC,
  649. CASE_BEAM_VEC,
  650. /*    d        e        f        g    */
  651. CASE_BEAM_VEC,
  652. CASE_CURSTATE,
  653. CASE_CURSTATE,
  654. CASE_BEAM_VEC,
  655. /*    h        i        j        k    */
  656. CASE_BEAM_VEC,
  657. CASE_BEAM_VEC,
  658. CASE_BEAM_VEC,
  659. CASE_BEAM_VEC,
  660. /*    l        m        n        o    */
  661. CASE_BEAM_VEC,
  662. CASE_CURSTATE,
  663. CASE_CURSTATE,
  664. CASE_BEAM_VEC,
  665. /*    p        q        r        s    */
  666. CASE_BEAM_VEC,
  667. CASE_BEAM_VEC,
  668. CASE_BEAM_VEC,
  669. CASE_BEAM_VEC,
  670. /*    t        u        v        w    */
  671. CASE_BEAM_VEC,
  672. CASE_CURSTATE,
  673. CASE_CURSTATE,
  674. CASE_BEAM_VEC,
  675. /*    x        y        z        {    */
  676. CASE_CURSTATE,
  677. CASE_CURSTATE,
  678. CASE_CURSTATE,
  679. CASE_CURSTATE,
  680. /*    |        }        ~        DEL    */
  681. CASE_CURSTATE,
  682. CASE_CURSTATE,
  683. CASE_IGNORE,
  684. CASE_CURSTATE,
  685. };
  686.  
  687. int Tipltable[] = {
  688. /*    NUL        SOH        STX        ETX    */
  689. CASE_IGNORE,
  690. CASE_IGNORE,
  691. CASE_IGNORE,
  692. CASE_IGNORE,
  693. /*    EOT        ENQ        ACK        BEL    */
  694. CASE_IGNORE,
  695. CASE_IGNORE,
  696. CASE_IGNORE,
  697. CASE_BEL,
  698. /*    BS        HT        NL        VT    */
  699. CASE_BS,
  700. CASE_TAB,
  701. CASE_LF,
  702. CASE_UP,
  703. /*    NP        CR        SO        SI    */
  704. CASE_IGNORE,
  705. CASE_CR,
  706. CASE_IGNORE,
  707. CASE_IGNORE,
  708. /*    DLE        DC1        DC2        DC3    */
  709. CASE_IGNORE,
  710. CASE_IGNORE,
  711. CASE_IGNORE,
  712. CASE_IGNORE,
  713. /*    DC4        NAK        SYN        ETB    */
  714. CASE_IGNORE,
  715. CASE_IGNORE,
  716. CASE_IGNORE,
  717. CASE_IGNORE,
  718. /*    CAN        EM        SUB        ESC    */
  719. CASE_IGNORE,
  720. CASE_IGNORE,
  721. CASE_IGNORE,
  722. CASE_ESC_STATE,
  723. /*    FS        GS        RS        US    */
  724. CASE_PT_STATE,
  725. CASE_PLT_STATE,
  726. CASE_IPL_STATE,
  727. CASE_ALP_STATE,
  728. /*    SP        !        "        #    */
  729. CASE_PENUP,
  730. CASE_IGNORE,
  731. CASE_IGNORE,
  732. CASE_IGNORE,
  733. /*    $        %        &        '    */
  734. CASE_IGNORE,
  735. CASE_IGNORE,
  736. CASE_IGNORE,
  737. CASE_IGNORE,
  738. /*    (        )        *        +    */
  739. CASE_IGNORE,
  740. CASE_IGNORE,
  741. CASE_IGNORE,
  742. CASE_IGNORE,
  743. /*    ,        -        .        /    */
  744. CASE_IGNORE,
  745. CASE_IGNORE,
  746. CASE_IGNORE,
  747. CASE_IGNORE,
  748. /*    0        1        2        3    */
  749. CASE_IGNORE,
  750. CASE_IGNORE,
  751. CASE_IGNORE,
  752. CASE_IGNORE,
  753. /*    4        5        6        7    */
  754. CASE_IGNORE,
  755. CASE_IGNORE,
  756. CASE_IGNORE,
  757. CASE_IGNORE,
  758. /*    8        9        :        ;    */
  759. CASE_IGNORE,
  760. CASE_IGNORE,
  761. CASE_IGNORE,
  762. CASE_IGNORE,
  763. /*    <        =        >        ?    */
  764. CASE_IGNORE,
  765. CASE_IGNORE,
  766. CASE_IGNORE,
  767. CASE_IGNORE,
  768. /*    @        A        B        C    */
  769. CASE_IGNORE,
  770. CASE_IPL_POINT,
  771. CASE_IPL_POINT,
  772. CASE_IGNORE,
  773. /*    D        E        F        G    */
  774. CASE_IPL_POINT,
  775. CASE_IPL_POINT,
  776. CASE_IPL_POINT,
  777. CASE_IGNORE,
  778. /*    H        I        J        K    */
  779. CASE_IPL_POINT,
  780. CASE_IPL_POINT,
  781. CASE_IPL_POINT,
  782. CASE_IGNORE,
  783. /*    L        M        N        O    */
  784. CASE_IGNORE,
  785. CASE_IGNORE,
  786. CASE_IGNORE,
  787. CASE_IGNORE,
  788. /*    P        Q        R        S    */
  789. CASE_PENDOWN,
  790. CASE_IGNORE,
  791. CASE_IGNORE,
  792. CASE_IGNORE,
  793. /*    T        U        V        W    */
  794. CASE_IGNORE,
  795. CASE_IGNORE,
  796. CASE_IGNORE,
  797. CASE_IGNORE,
  798. /*    X        Y        Z        [    */
  799. CASE_IGNORE,
  800. CASE_IGNORE,
  801. CASE_IGNORE,
  802. CASE_IGNORE,
  803. /*    \        ]        ^        _    */
  804. CASE_IGNORE,
  805. CASE_IGNORE,
  806. CASE_IGNORE,
  807. CASE_IGNORE,
  808. /*    `        a        b        c    */
  809. CASE_IGNORE,
  810. CASE_IGNORE,
  811. CASE_IGNORE,
  812. CASE_IGNORE,
  813. /*    d        e        f        g    */
  814. CASE_IGNORE,
  815. CASE_IGNORE,
  816. CASE_IGNORE,
  817. CASE_IGNORE,
  818. /*    h        i        j        k    */
  819. CASE_IGNORE,
  820. CASE_IGNORE,
  821. CASE_IGNORE,
  822. CASE_IGNORE,
  823. /*    l        m        n        o    */
  824. CASE_IGNORE,
  825. CASE_IGNORE,
  826. CASE_IGNORE,
  827. CASE_IGNORE,
  828. /*    p        q        r        s    */
  829. CASE_IGNORE,
  830. CASE_IGNORE,
  831. CASE_IGNORE,
  832. CASE_IGNORE,
  833. /*    t        u        v        w    */
  834. CASE_IGNORE,
  835. CASE_IGNORE,
  836. CASE_IGNORE,
  837. CASE_IGNORE,
  838. /*    x        y        z        {    */
  839. CASE_IGNORE,
  840. CASE_IGNORE,
  841. CASE_IGNORE,
  842. CASE_IGNORE,
  843. /*    |        }        ~        DEL    */
  844. CASE_IGNORE,
  845. CASE_IGNORE,
  846. CASE_IGNORE,
  847. CASE_IGNORE,
  848. };
  849.  
  850. int Tplttable[] = {
  851. /*    NUL        SOH        STX        ETX    */
  852. CASE_IGNORE,
  853. CASE_IGNORE,
  854. CASE_IGNORE,
  855. CASE_IGNORE,
  856. /*    EOT        ENQ        ACK        BEL    */
  857. CASE_IGNORE,
  858. CASE_IGNORE,
  859. CASE_IGNORE,
  860. CASE_BEL,
  861. /*    BS        HT        NL        VT    */
  862. CASE_BS,
  863. CASE_TAB,
  864. CASE_LF,
  865. CASE_UP,
  866. /*    NP        CR        SO        SI    */
  867. CASE_IGNORE,
  868. CASE_CR,
  869. CASE_IGNORE,
  870. CASE_IGNORE,
  871. /*    DLE        DC1        DC2        DC3    */
  872. CASE_IGNORE,
  873. CASE_IGNORE,
  874. CASE_IGNORE,
  875. CASE_IGNORE,
  876. /*    DC4        NAK        SYN        ETB    */
  877. CASE_IGNORE,
  878. CASE_IGNORE,
  879. CASE_IGNORE,
  880. CASE_IGNORE,
  881. /*    CAN        EM        SUB        ESC    */
  882. CASE_IGNORE,
  883. CASE_IGNORE,
  884. CASE_IGNORE,
  885. CASE_ESC_STATE,
  886. /*    FS        GS        RS        US    */
  887. CASE_PT_STATE,
  888. CASE_PLT_STATE,
  889. CASE_IPL_STATE,
  890. CASE_ALP_STATE,
  891. /*    SP        !        "        #    */
  892. CASE_PLT_VEC,
  893. CASE_PLT_VEC,
  894. CASE_PLT_VEC,
  895. CASE_PLT_VEC,
  896. /*    $        %        &        '    */
  897. CASE_PLT_VEC,
  898. CASE_PLT_VEC,
  899. CASE_PLT_VEC,
  900. CASE_PLT_VEC,
  901. /*    (        )        *        +    */
  902. CASE_PLT_VEC,
  903. CASE_PLT_VEC,
  904. CASE_PLT_VEC,
  905. CASE_PLT_VEC,
  906. /*    ,        -        .        /    */
  907. CASE_PLT_VEC,
  908. CASE_PLT_VEC,
  909. CASE_PLT_VEC,
  910. CASE_PLT_VEC,
  911. /*    0        1        2        3    */
  912. CASE_PLT_VEC,
  913. CASE_PLT_VEC,
  914. CASE_PLT_VEC,
  915. CASE_PLT_VEC,
  916. /*    4        5        6        7    */
  917. CASE_PLT_VEC,
  918. CASE_PLT_VEC,
  919. CASE_PLT_VEC,
  920. CASE_PLT_VEC,
  921. /*    8        9        :        ;    */
  922. CASE_PLT_VEC,
  923. CASE_PLT_VEC,
  924. CASE_PLT_VEC,
  925. CASE_PLT_VEC,
  926. /*    <        =        >        ?    */
  927. CASE_PLT_VEC,
  928. CASE_PLT_VEC,
  929. CASE_PLT_VEC,
  930. CASE_PLT_VEC,
  931. /*    @        A        B        C    */
  932. CASE_PLT_VEC,
  933. CASE_PLT_VEC,
  934. CASE_PLT_VEC,
  935. CASE_PLT_VEC,
  936. /*    D        E        F        G    */
  937. CASE_PLT_VEC,
  938. CASE_PLT_VEC,
  939. CASE_PLT_VEC,
  940. CASE_PLT_VEC,
  941. /*    H        I        J        K    */
  942. CASE_PLT_VEC,
  943. CASE_PLT_VEC,
  944. CASE_PLT_VEC,
  945. CASE_PLT_VEC,
  946. /*    L        M        N        O    */
  947. CASE_PLT_VEC,
  948. CASE_PLT_VEC,
  949. CASE_PLT_VEC,
  950. CASE_PLT_VEC,
  951. /*    P        Q        R        S    */
  952. CASE_PLT_VEC,
  953. CASE_PLT_VEC,
  954. CASE_PLT_VEC,
  955. CASE_PLT_VEC,
  956. /*    T        U        V        W    */
  957. CASE_PLT_VEC,
  958. CASE_PLT_VEC,
  959. CASE_PLT_VEC,
  960. CASE_PLT_VEC,
  961. /*    X        Y        Z        [    */
  962. CASE_PLT_VEC,
  963. CASE_PLT_VEC,
  964. CASE_PLT_VEC,
  965. CASE_PLT_VEC,
  966. /*    \        ]        ^        _    */
  967. CASE_PLT_VEC,
  968. CASE_PLT_VEC,
  969. CASE_PLT_VEC,
  970. CASE_PLT_VEC,
  971. /*    `        a        b        c    */
  972. CASE_PLT_VEC,
  973. CASE_PLT_VEC,
  974. CASE_PLT_VEC,
  975. CASE_PLT_VEC,
  976. /*    d        e        f        g    */
  977. CASE_PLT_VEC,
  978. CASE_PLT_VEC,
  979. CASE_PLT_VEC,
  980. CASE_PLT_VEC,
  981. /*    h        i        j        k    */
  982. CASE_PLT_VEC,
  983. CASE_PLT_VEC,
  984. CASE_PLT_VEC,
  985. CASE_PLT_VEC,
  986. /*    l        m        n        o    */
  987. CASE_PLT_VEC,
  988. CASE_PLT_VEC,
  989. CASE_PLT_VEC,
  990. CASE_PLT_VEC,
  991. /*    p        q        r        s    */
  992. CASE_PLT_VEC,
  993. CASE_PLT_VEC,
  994. CASE_PLT_VEC,
  995. CASE_PLT_VEC,
  996. /*    t        u        v        w    */
  997. CASE_PLT_VEC,
  998. CASE_PLT_VEC,
  999. CASE_PLT_VEC,
  1000. CASE_PLT_VEC,
  1001. /*    x        y        z        {    */
  1002. CASE_PLT_VEC,
  1003. CASE_PLT_VEC,
  1004. CASE_PLT_VEC,
  1005. CASE_PLT_VEC,
  1006. /*    |        }        ~        DEL    */
  1007. CASE_PLT_VEC,
  1008. CASE_PLT_VEC,
  1009. CASE_PLT_VEC,
  1010. CASE_PLT_VEC,
  1011. };
  1012.  
  1013. int Tpttable[] = {
  1014. /*    NUL        SOH        STX        ETX    */
  1015. CASE_IGNORE,
  1016. CASE_IGNORE,
  1017. CASE_IGNORE,
  1018. CASE_IGNORE,
  1019. /*    EOT        ENQ        ACK        BEL    */
  1020. CASE_IGNORE,
  1021. CASE_IGNORE,
  1022. CASE_IGNORE,
  1023. CASE_BEL,
  1024. /*    BS        HT        NL        VT    */
  1025. CASE_BS,
  1026. CASE_TAB,
  1027. CASE_LF,
  1028. CASE_UP,
  1029. /*    NP        CR        SO        SI    */
  1030. CASE_IGNORE,
  1031. CASE_CR,
  1032. CASE_IGNORE,
  1033. CASE_IGNORE,
  1034. /*    DLE        DC1        DC2        DC3    */
  1035. CASE_IGNORE,
  1036. CASE_IGNORE,
  1037. CASE_IGNORE,
  1038. CASE_IGNORE,
  1039. /*    DC4        NAK        SYN        ETB    */
  1040. CASE_IGNORE,
  1041. CASE_IGNORE,
  1042. CASE_IGNORE,
  1043. CASE_IGNORE,
  1044. /*    CAN        EM        SUB        ESC    */
  1045. CASE_IGNORE,
  1046. CASE_IGNORE,
  1047. CASE_IGNORE,
  1048. CASE_ESC_STATE,
  1049. /*    FS        GS        RS        US    */
  1050. CASE_PT_STATE,
  1051. CASE_PLT_STATE,
  1052. CASE_IPL_STATE,
  1053. CASE_ALP_STATE,
  1054. /*    SP        !        "        #    */
  1055. CASE_PT_POINT,
  1056. CASE_PT_POINT,
  1057. CASE_PT_POINT,
  1058. CASE_PT_POINT,
  1059. /*    $        %        &        '    */
  1060. CASE_PT_POINT,
  1061. CASE_PT_POINT,
  1062. CASE_PT_POINT,
  1063. CASE_PT_POINT,
  1064. /*    (        )        *        +    */
  1065. CASE_PT_POINT,
  1066. CASE_PT_POINT,
  1067. CASE_PT_POINT,
  1068. CASE_PT_POINT,
  1069. /*    ,        -        .        /    */
  1070. CASE_PT_POINT,
  1071. CASE_PT_POINT,
  1072. CASE_PT_POINT,
  1073. CASE_PT_POINT,
  1074. /*    0        1        2        3    */
  1075. CASE_PT_POINT,
  1076. CASE_PT_POINT,
  1077. CASE_PT_POINT,
  1078. CASE_PT_POINT,
  1079. /*    4        5        6        7    */
  1080. CASE_PT_POINT,
  1081. CASE_PT_POINT,
  1082. CASE_PT_POINT,
  1083. CASE_PT_POINT,
  1084. /*    8        9        :        ;    */
  1085. CASE_PT_POINT,
  1086. CASE_PT_POINT,
  1087. CASE_PT_POINT,
  1088. CASE_PT_POINT,
  1089. /*    <        =        >        ?    */
  1090. CASE_PT_POINT,
  1091. CASE_PT_POINT,
  1092. CASE_PT_POINT,
  1093. CASE_PT_POINT,
  1094. /*    @        A        B        C    */
  1095. CASE_PT_POINT,
  1096. CASE_PT_POINT,
  1097. CASE_PT_POINT,
  1098. CASE_PT_POINT,
  1099. /*    D        E        F        G    */
  1100. CASE_PT_POINT,
  1101. CASE_PT_POINT,
  1102. CASE_PT_POINT,
  1103. CASE_PT_POINT,
  1104. /*    H        I        J        K    */
  1105. CASE_PT_POINT,
  1106. CASE_PT_POINT,
  1107. CASE_PT_POINT,
  1108. CASE_PT_POINT,
  1109. /*    L        M        N        O    */
  1110. CASE_PT_POINT,
  1111. CASE_PT_POINT,
  1112. CASE_PT_POINT,
  1113. CASE_PT_POINT,
  1114. /*    P        Q        R        S    */
  1115. CASE_PT_POINT,
  1116. CASE_PT_POINT,
  1117. CASE_PT_POINT,
  1118. CASE_PT_POINT,
  1119. /*    T        U        V        W    */
  1120. CASE_PT_POINT,
  1121. CASE_PT_POINT,
  1122. CASE_PT_POINT,
  1123. CASE_PT_POINT,
  1124. /*    X        Y        Z        [    */
  1125. CASE_PT_POINT,
  1126. CASE_PT_POINT,
  1127. CASE_PT_POINT,
  1128. CASE_PT_POINT,
  1129. /*    \        ]        ^        _    */
  1130. CASE_PT_POINT,
  1131. CASE_PT_POINT,
  1132. CASE_PT_POINT,
  1133. CASE_PT_POINT,
  1134. /*    `        a        b        c    */
  1135. CASE_PT_POINT,
  1136. CASE_PT_POINT,
  1137. CASE_PT_POINT,
  1138. CASE_PT_POINT,
  1139. /*    d        e        f        g    */
  1140. CASE_PT_POINT,
  1141. CASE_PT_POINT,
  1142. CASE_PT_POINT,
  1143. CASE_PT_POINT,
  1144. /*    h        i        j        k    */
  1145. CASE_PT_POINT,
  1146. CASE_PT_POINT,
  1147. CASE_PT_POINT,
  1148. CASE_PT_POINT,
  1149. /*    l        m        n        o    */
  1150. CASE_PT_POINT,
  1151. CASE_PT_POINT,
  1152. CASE_PT_POINT,
  1153. CASE_PT_POINT,
  1154. /*    p        q        r        s    */
  1155. CASE_PT_POINT,
  1156. CASE_PT_POINT,
  1157. CASE_PT_POINT,
  1158. CASE_PT_POINT,
  1159. /*    t        u        v        w    */
  1160. CASE_PT_POINT,
  1161. CASE_PT_POINT,
  1162. CASE_PT_POINT,
  1163. CASE_PT_POINT,
  1164. /*    x        y        z        {    */
  1165. CASE_PT_POINT,
  1166. CASE_PT_POINT,
  1167. CASE_PT_POINT,
  1168. CASE_PT_POINT,
  1169. /*    |        }        ~        DEL    */
  1170. CASE_PT_POINT,
  1171. CASE_PT_POINT,
  1172. CASE_PT_POINT,
  1173. CASE_PT_POINT,
  1174. };
  1175.  
  1176. int Tspttable[] = {
  1177. /*    NUL        SOH        STX        ETX    */
  1178. CASE_IGNORE,
  1179. CASE_IGNORE,
  1180. CASE_IGNORE,
  1181. CASE_IGNORE,
  1182. /*    EOT        ENQ        ACK        BEL    */
  1183. CASE_IGNORE,
  1184. CASE_IGNORE,
  1185. CASE_IGNORE,
  1186. CASE_BEL,
  1187. /*    BS        HT        NL        VT    */
  1188. CASE_BS,
  1189. CASE_TAB,
  1190. CASE_LF,
  1191. CASE_UP,
  1192. /*    NP        CR        SO        SI    */
  1193. CASE_IGNORE,
  1194. CASE_CR,
  1195. CASE_IGNORE,
  1196. CASE_IGNORE,
  1197. /*    DLE        DC1        DC2        DC3    */
  1198. CASE_IGNORE,
  1199. CASE_IGNORE,
  1200. CASE_IGNORE,
  1201. CASE_IGNORE,
  1202. /*    DC4        NAK        SYN        ETB    */
  1203. CASE_IGNORE,
  1204. CASE_IGNORE,
  1205. CASE_IGNORE,
  1206. CASE_IGNORE,
  1207. /*    CAN        EM        SUB        ESC    */
  1208. CASE_IGNORE,
  1209. CASE_IGNORE,
  1210. CASE_IGNORE,
  1211. CASE_ESC_STATE,
  1212. /*    FS        GS        RS        US    */
  1213. CASE_PT_STATE,
  1214. CASE_PLT_STATE,
  1215. CASE_IPL_STATE,
  1216. CASE_ALP_STATE,
  1217. /*    SP        !        "        #    */
  1218. CASE_SPT_POINT,
  1219. CASE_SPT_POINT,
  1220. CASE_SPT_POINT,
  1221. CASE_SPT_POINT,
  1222. /*    $        %        &        '    */
  1223. CASE_SPT_POINT,
  1224. CASE_SPT_POINT,
  1225. CASE_SPT_POINT,
  1226. CASE_SPT_POINT,
  1227. /*    (        )        *        +    */
  1228. CASE_SPT_POINT,
  1229. CASE_SPT_POINT,
  1230. CASE_SPT_POINT,
  1231. CASE_SPT_POINT,
  1232. /*    ,        -        .        /    */
  1233. CASE_SPT_POINT,
  1234. CASE_SPT_POINT,
  1235. CASE_SPT_POINT,
  1236. CASE_SPT_POINT,
  1237. /*    0        1        2        3    */
  1238. CASE_SPT_POINT,
  1239. CASE_SPT_POINT,
  1240. CASE_SPT_POINT,
  1241. CASE_SPT_POINT,
  1242. /*    4        5        6        7    */
  1243. CASE_SPT_POINT,
  1244. CASE_SPT_POINT,
  1245. CASE_SPT_POINT,
  1246. CASE_SPT_POINT,
  1247. /*    8        9        :        ;    */
  1248. CASE_SPT_POINT,
  1249. CASE_SPT_POINT,
  1250. CASE_SPT_POINT,
  1251. CASE_SPT_POINT,
  1252. /*    <        =        >        ?    */
  1253. CASE_SPT_POINT,
  1254. CASE_SPT_POINT,
  1255. CASE_SPT_POINT,
  1256. CASE_SPT_POINT,
  1257. /*    @        A        B        C    */
  1258. CASE_SPT_POINT,
  1259. CASE_SPT_POINT,
  1260. CASE_SPT_POINT,
  1261. CASE_SPT_POINT,
  1262. /*    D        E        F        G    */
  1263. CASE_SPT_POINT,
  1264. CASE_SPT_POINT,
  1265. CASE_SPT_POINT,
  1266. CASE_SPT_POINT,
  1267. /*    H        I        J        K    */
  1268. CASE_SPT_POINT,
  1269. CASE_SPT_POINT,
  1270. CASE_SPT_POINT,
  1271. CASE_SPT_POINT,
  1272. /*    L        M        N        O    */
  1273. CASE_SPT_POINT,
  1274. CASE_SPT_POINT,
  1275. CASE_SPT_POINT,
  1276. CASE_SPT_POINT,
  1277. /*    P        Q        R        S    */
  1278. CASE_SPT_POINT,
  1279. CASE_SPT_POINT,
  1280. CASE_SPT_POINT,
  1281. CASE_SPT_POINT,
  1282. /*    T        U        V        W    */
  1283. CASE_SPT_POINT,
  1284. CASE_SPT_POINT,
  1285. CASE_SPT_POINT,
  1286. CASE_SPT_POINT,
  1287. /*    X        Y        Z        [    */
  1288. CASE_SPT_POINT,
  1289. CASE_SPT_POINT,
  1290. CASE_SPT_POINT,
  1291. CASE_SPT_POINT,
  1292. /*    \        ]        ^        _    */
  1293. CASE_SPT_POINT,
  1294. CASE_SPT_POINT,
  1295. CASE_SPT_POINT,
  1296. CASE_SPT_POINT,
  1297. /*    `        a        b        c    */
  1298. CASE_SPT_POINT,
  1299. CASE_SPT_POINT,
  1300. CASE_SPT_POINT,
  1301. CASE_SPT_POINT,
  1302. /*    d        e        f        g    */
  1303. CASE_SPT_POINT,
  1304. CASE_SPT_POINT,
  1305. CASE_SPT_POINT,
  1306. CASE_SPT_POINT,
  1307. /*    h        i        j        k    */
  1308. CASE_SPT_POINT,
  1309. CASE_SPT_POINT,
  1310. CASE_SPT_POINT,
  1311. CASE_SPT_POINT,
  1312. /*    l        m        n        o    */
  1313. CASE_SPT_POINT,
  1314. CASE_SPT_POINT,
  1315. CASE_SPT_POINT,
  1316. CASE_SPT_POINT,
  1317. /*    p        q        r        s    */
  1318. CASE_SPT_POINT,
  1319. CASE_SPT_POINT,
  1320. CASE_SPT_POINT,
  1321. CASE_SPT_POINT,
  1322. /*    t        u        v        w    */
  1323. CASE_SPT_POINT,
  1324. CASE_SPT_POINT,
  1325. CASE_SPT_POINT,
  1326. CASE_SPT_POINT,
  1327. /*    x        y        z        {    */
  1328. CASE_SPT_POINT,
  1329. CASE_SPT_POINT,
  1330. CASE_SPT_POINT,
  1331. CASE_SPT_POINT,
  1332. /*    |        }        ~        DEL    */
  1333. CASE_SPT_POINT,
  1334. CASE_SPT_POINT,
  1335. CASE_SPT_POINT,
  1336. CASE_SPT_POINT,
  1337. };
  1338. RAZZLE!DAZZLE
  1339. fi    # End Tekparsetable.c
  1340. if test -f Tekproc.c
  1341. then
  1342.     echo shar: will not overwrite existing file "'Tekproc.c'"
  1343. else
  1344. echo 'x - Tekproc.c'
  1345. cat << \RAZZLE!DAZZLE > Tekproc.c
  1346. /*
  1347.  *    $Source: /u1/X/xterm/RCS/Tekproc.c,v $
  1348.  *    $Header: Tekproc.c,v 10.104 86/12/02 11:35:38 swick Exp $
  1349.  */
  1350.  
  1351. #include <X/mit-copyright.h>
  1352.  
  1353. /* Copyright (c) 1985 Massachusetts Institute of Technology        */
  1354. /* Copyright (c) 1985    Digital Equipment Corporation            */
  1355.  
  1356. /* Tekproc.c */
  1357.  
  1358. #include <X/Xlib.h>
  1359. #include "scrollbar.h"
  1360. #include "ptyx.h"
  1361. #include "Tekparse.h"
  1362. #include <stdio.h>
  1363. #include <sgtty.h>
  1364. #include <ctype.h>
  1365. #include <errno.h>
  1366. #include <setjmp.h>
  1367. #include <sys/time.h>
  1368. #include <sys/file.h>
  1369. #include <pwd.h>
  1370. #include "data.h"
  1371. #include "error.h"
  1372. #ifdef MODEMENU
  1373. #include "menu.h"
  1374. #endif MODEMENU
  1375.  
  1376. /* Tek defines */
  1377.  
  1378. #define    BEL        07
  1379. #define    CANCEL        030
  1380. #define    DOTDASHEDLINE    2
  1381. #define    DOTTEDLINE    1
  1382. #define    EAST        01
  1383. #define    ETX        03
  1384. #define ICONFONT    4
  1385. #define    LARGEFONT    0
  1386. #define    LARGEFONTNAME    "9x15"
  1387. #define    LINEMASK    07
  1388. #define    LONGDASHEDLINE    4
  1389. #define    MARGIN1        0
  1390. #define    MARGIN2        1
  1391. #define MAX_PTS        150
  1392. #define MAX_VTX        300
  1393. #define    NAK        025
  1394. #define    NORTH        04
  1395. #define    PENDOWN        1
  1396. #define    PENUP        0
  1397. #define    SHORTDASHEDLINE    3
  1398. #define    SMALLFONT    3
  1399. #define    SMALLFONTNAME    "6x10"
  1400. #define    SOLIDLINE    0
  1401. #define    SOUTH        010
  1402. #define    TEKBOTTOMPAD    23
  1403. #define    TEKDEFHEIGHT    565
  1404. #define    TEKDEFWIDTH    750
  1405. #define    TEKHEIGHT    3072
  1406. #define    TEKHOME        ((TekChar[screen->page.fontsize].nlines - 1)\
  1407.              * TekChar[screen->page.fontsize].vsize)
  1408. #define    TEKMINHEIGHT    452
  1409. #define    TEKMINWIDTH    600
  1410. #define    TEKPAD        57
  1411. #define    TEKTOPPAD    34
  1412. #define    TEKWIDTH    4096
  1413. #define    TEXT_BUF_SIZE    256
  1414. #define    THREEFONT    2
  1415. #define    THREEFONTNAME    "8x13"
  1416. #define    TWOFONT        1
  1417. #define    TWOFONTNAME    "6x13"
  1418. #define    WEST        02
  1419.  
  1420. #define    TekMove(x,y)    screen->cur_X = x; screen->cur_Y = y
  1421. #define    input()        Tinput()
  1422. #define    unput(c)    *Tpushback++ = c
  1423.  
  1424. #ifndef lint
  1425. static char sccs_id[] = "@(#)Tekproc.c\tX10/6.6B\t12/26/86";
  1426. #endif lint
  1427.  
  1428. static Vertex *T_box[TEKNUMFONTS] = {
  1429.     T_boxlarge,
  1430.     T_box2,
  1431.     T_box3,
  1432.     T_boxsmall,
  1433.     T_boxicon,
  1434. };
  1435. static struct Tek_Char {
  1436.     int hsize;    /* in Tek units */
  1437.     int vsize;    /* in Tek units */
  1438.     int charsperline;
  1439.     int nlines;
  1440. } TekChar[TEKNUMFONTS] = {
  1441.     {56, 88, 74, 35},    /* large */
  1442.     {51, 82, 81, 38},    /* #2 */
  1443.     {34, 53, 121, 58},    /* #3 */
  1444.     {31, 48, 133, 64},    /* small */
  1445.     {56, 88, 74,  35},    /* icon is same as large */
  1446. };
  1447.  
  1448. static int *curstate;
  1449. static Cursor GINcursor;
  1450. static Vertex *line_pt;
  1451. static int nplot;
  1452. static TekLink Tek0;
  1453. static jmp_buf Tekjump;
  1454. static TekLink *TekRecord;
  1455. static Vertex *Tline;
  1456. static int *Tparsestate;
  1457.  
  1458. extern int Talptable[];
  1459. extern int Tbestable[];
  1460. extern int Tbyptable[];
  1461. extern int Tesctable[];
  1462. extern int Tipltable[];
  1463. extern int Tplttable[];
  1464. extern int Tpttable[];
  1465. extern int Tspttable[];
  1466.  
  1467. Tekparse()
  1468. {
  1469.     register Screen *screen = &term.screen;
  1470.     register int c, x, y;
  1471.     register char *cp;
  1472.     char ch;
  1473.     int arg;
  1474.     int Tinput();
  1475.  
  1476.     for( ; ; )
  1477.         switch(Tparsestate[c = input()]) {
  1478.          case CASE_REPORT:
  1479.             /* report address */
  1480.             if(screen->TekGIN) {
  1481.                 TekGINoff();
  1482.                 TekEnqMouse(0);
  1483.             } else {
  1484.                 c = 064;    /* has hard copy unit */
  1485.                 if(screen->margin == MARGIN2)
  1486.                     c |= 02;
  1487.                 TekEnq(c, screen->cur_X, screen->cur_Y);
  1488.             }
  1489.             TekRecord->ptr[-1] = NAK; /* remove from recording */
  1490.             Tparsestate = curstate;
  1491.             break;
  1492.  
  1493.          case CASE_VT_MODE:
  1494.             /* special return to vt102 mode */
  1495.             Tparsestate = curstate;
  1496.             TekRecord->ptr[-1] = NAK; /* remove from recording */
  1497.             if(screen->logging) {
  1498.                 FlushLog(screen);
  1499.                 screen->logstart = buffer;
  1500.             }
  1501.             return;
  1502.  
  1503.          case CASE_SPT_STATE:
  1504.             /* Enter Special Point Plot mode */
  1505.             if(screen->TekGIN)
  1506.                 TekGINoff();
  1507.             Tparsestate = curstate = Tspttable;
  1508.             break;
  1509.  
  1510.          case CASE_GIN:
  1511.             /* Do Tek GIN mode */
  1512.             screen->TekGIN = &TekRecord->ptr[-1];
  1513.                 /* Set cross-hair cursor raster array */
  1514.             if(GINcursor = make_tcross(screen->mousecolor,
  1515.              screen->background, GXcopy))
  1516.                 XDefineCursor(TWindow(screen), GINcursor);
  1517.             Tparsestate = Tbyptable;    /* Bypass mode */
  1518.             break;
  1519.  
  1520.          case CASE_BEL:
  1521.             /* BEL */
  1522.             if(screen->TekGIN)
  1523.                 TekGINoff();
  1524.             if(!TekRefresh)
  1525.                 Bell();
  1526.             Tparsestate = curstate;    /* clear bypass condition */
  1527.             break;
  1528.  
  1529.          case CASE_BS:
  1530.             /* BS */
  1531.             if(screen->TekGIN)
  1532.                 TekGINoff();
  1533.             Tparsestate = curstate;    /* clear bypass condition */
  1534.             TCursorBack();
  1535.             break;
  1536.  
  1537.          case CASE_PT_STATE:
  1538.             /* Enter Tek Point Plot mode */
  1539.             if(screen->TekGIN)
  1540.                 TekGINoff();
  1541.             Tparsestate = curstate = Tpttable;
  1542.             break;
  1543.  
  1544.          case CASE_PLT_STATE:
  1545.             /* Enter Tek Plot mode */
  1546.             if(screen->TekGIN)
  1547.                 TekGINoff();
  1548.             Tparsestate = curstate = Tplttable;
  1549.             if((c = input()) == BEL)
  1550.                 screen->pen = PENDOWN;
  1551.             else {
  1552.                 unput(c);
  1553.                 screen->pen = PENUP;
  1554.             }
  1555.             break;
  1556.  
  1557.          case CASE_TAB:
  1558.             /* HT */
  1559.             if(screen->TekGIN)
  1560.                 TekGINoff();
  1561.             Tparsestate = curstate;    /* clear bypass condition */
  1562.             TCursorForward();
  1563.             break;
  1564.  
  1565.          case CASE_IPL_STATE:
  1566.             /* Enter Tek Incremental Plot mode */
  1567.             if(screen->TekGIN)
  1568.                 TekGINoff();
  1569.             Tparsestate = curstate = Tipltable;
  1570.             break;
  1571.  
  1572.          case CASE_ALP_STATE:
  1573.             /* Enter Tek Alpha mode from any other mode */
  1574.             if(screen->TekGIN)
  1575.                 TekGINoff();
  1576.             /* if in one of graphics states, move alpha cursor */
  1577.             if(nplot > 0)    /* flush line Tbuffer */
  1578.                 TekFlush();
  1579.             Tparsestate = curstate = Talptable;
  1580.             break;
  1581.  
  1582.          case CASE_UP:
  1583.             /* cursor up */
  1584.             if(screen->TekGIN)
  1585.                 TekGINoff();
  1586.             Tparsestate = curstate;    /* clear bypass condition */
  1587.             TCursorUp();
  1588.             break;
  1589.  
  1590.          case CASE_COPY:
  1591.             /* make copy */
  1592.             if(screen->TekGIN)
  1593.                 TekGINoff();
  1594.             TekCopy();
  1595.             TekRecord->ptr[-1] = NAK; /* remove from recording */
  1596.             Tparsestate = curstate;    /* clear bypass condition */
  1597.             break;
  1598.  
  1599.          case CASE_PAGE:
  1600.             /* Page Function */
  1601.             if(screen->TekGIN)
  1602.                 TekGINoff();
  1603.             TekPage();    /* clear bypass condition */
  1604.             break;
  1605.  
  1606.          case CASE_BES_STATE:
  1607.             /* Byp: an escape char */
  1608.             Tparsestate = Tbestable;
  1609.             break;
  1610.  
  1611.          case CASE_BYP_STATE:
  1612.             /* set bypass condition */
  1613.             Tparsestate = Tbyptable;
  1614.             break;
  1615.  
  1616.          case CASE_IGNORE:
  1617.             /* Esc: totally ignore CR, ESC, LF, ~ */
  1618.             break;
  1619.  
  1620.          case CASE_ASCII:
  1621.             /* Select ASCII char set */
  1622.             /* ignore for now */
  1623.             Tparsestate = curstate;
  1624.             break;
  1625.  
  1626.          case CASE_APL:
  1627.             /* Select APL char set */
  1628.             /* ignore for now */
  1629.             Tparsestate = curstate;
  1630.             break;
  1631.  
  1632.          case CASE_CHAR_SIZE:
  1633.             /* character size selector */
  1634.             screen->cur.fontsize = c & 03;
  1635.             Tparsestate = curstate;
  1636.             break;
  1637.  
  1638.          case CASE_BEAM_VEC:
  1639.             /* beam and vector selector */
  1640.             /* only line types */
  1641.             if((c &= LINEMASK) != screen->cur.linetype) {
  1642.                 if(nplot > 0)
  1643.                     TekFlush();
  1644.                 screen->cur.linetype = c;
  1645.             }
  1646.             Tparsestate = curstate;
  1647.             break;
  1648.  
  1649.          case CASE_CURSTATE:
  1650.             Tparsestate = curstate;
  1651.             break;
  1652.  
  1653.          case CASE_PENUP:
  1654.             /* Ipl: penup */
  1655.             screen->pen = PENUP;
  1656.             break;
  1657.  
  1658.          case CASE_PENDOWN:
  1659.             /* Ipl: pendown */
  1660.             screen->pen = PENDOWN;
  1661.             break;
  1662.  
  1663.          case CASE_IPL_POINT:
  1664.             /* Ipl: point */
  1665.             x = screen->cur_X;
  1666.             y = screen->cur_Y;
  1667.             if(c & NORTH)
  1668.                 y++;
  1669.             else if(c & SOUTH)
  1670.                 y--;
  1671.             if(c & EAST)
  1672.                 x++;
  1673.             else if(c & WEST)
  1674.                 x--;
  1675.             if(screen->pen == PENDOWN)
  1676.                 TekDraw(x, y);
  1677.             else
  1678.                 TekMove(x, y);
  1679.             break;
  1680.  
  1681.          case CASE_PLT_VEC:
  1682.             /* Plt: vector */
  1683.             unput(c);
  1684.             if(getpoint()) {
  1685.                 if(screen->pen == PENDOWN)
  1686.                     TekDraw(screen->cur.x, screen->cur.y);
  1687.                 else
  1688.                     TekMove(screen->cur.x, screen->cur.y);
  1689.                 screen->pen = PENDOWN;
  1690.             }
  1691.             break;
  1692.  
  1693.          case CASE_PT_POINT:
  1694.             /* Pt: point */
  1695.             unput(c);
  1696.             if(getpoint()) {
  1697.                 TekMove(screen->cur.x, screen->cur.y);
  1698.                 TekDraw(screen->cur.x, screen->cur.y);
  1699.             }
  1700.             break;
  1701.  
  1702.          case CASE_SPT_POINT:
  1703.             /* Spt: point */
  1704.             /* ignore intensity character in c */
  1705.             if(getpoint()) {
  1706.                 TekMove(screen->cur.x, screen->cur.y);
  1707.                 TekDraw(screen->cur.x, screen->cur.y);
  1708.             }
  1709.             break;
  1710.  
  1711.          case CASE_CR:
  1712.             /* CR */
  1713.             if(screen->TekGIN)
  1714.                 TekGINoff();
  1715.             if(nplot > 0)    /* flush line Tbuffer */
  1716.                 TekFlush();
  1717.             screen->cur_X = screen->margin == MARGIN1 ? 0 :
  1718.              TEKWIDTH / 2;
  1719.             Tparsestate = curstate = Talptable;
  1720.             break;
  1721.  
  1722.          case CASE_ESC_STATE:
  1723.             /* ESC */
  1724.             Tparsestate = Tesctable;
  1725.             break;
  1726.  
  1727.          case CASE_LF:
  1728.             /* LF */
  1729.             if(screen->TekGIN)
  1730.                 TekGINoff();
  1731.             TCursorDown();
  1732.             if(!TekRefresh && (screen->display->qlen > 0 ||
  1733.              (ioctl(screen->display->fd, FIONREAD, &arg), arg) > 0))
  1734.                 xevents();
  1735.             break;
  1736.  
  1737.          case CASE_SP:
  1738.             /* SP */
  1739.             TCursorForward();
  1740.             break;
  1741.  
  1742.          case CASE_PRINT:
  1743.             /* printable character */
  1744.             ch = c;
  1745.             c = TActiveIcon(screen)
  1746.                 ? ICONFONT
  1747.                 : screen->cur.fontsize;
  1748.  
  1749.             XTextMask(TWindow(screen), (int)(screen->cur_X *
  1750.              TekScale(screen)) + screen->border,
  1751.              (int)((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) *
  1752.              TekScale(screen)) + screen->border + TTitlebar(screen)
  1753.              - screen->tobaseline[c], &ch, 1, screen->Tfont[c],
  1754.              screen->Tforeground);
  1755.             TCursorForward();
  1756.             break;
  1757.          case CASE_OSC:
  1758.             /* do osc escape */
  1759.             do_osc(Tinput);
  1760.             Tparsestate = curstate;
  1761.             break;
  1762.         }
  1763. }
  1764.  
  1765. static int rcnt;
  1766. static char *rptr;
  1767. static int Tselect_mask;
  1768.  
  1769. Tinput()
  1770. {
  1771.     register Screen *screen = &term.screen;
  1772.     register char *cp;
  1773.     register int i;
  1774.     register TekLink *tek;
  1775.     extern char *malloc();
  1776.  
  1777.     if(Tpushback > Tpushb)
  1778.         return(*--Tpushback);
  1779.     if(TekRefresh) {
  1780.         if(rcnt-- > 0)
  1781.             return(*rptr++);
  1782.         if(tek = TekRefresh->next) {
  1783.             TekRefresh = tek;
  1784.             rcnt = tek->count - 1;
  1785.             rptr = tek->data;
  1786.             return(*rptr++);
  1787.         }
  1788.         TekRefresh = (TekLink *)0;
  1789.         longjmp(Tekjump, 1);
  1790.     }
  1791. again:
  1792.     if(Tbcnt-- <= 0) {
  1793.         if(nplot > 0)    /* flush line Tbuffer */
  1794.             TekFlush();
  1795.         Tselect_mask = pty_mask;    /* force a read */
  1796.         for( ; ; ) {
  1797.             if(Tselect_mask & pty_mask) {
  1798.                 if(screen->logging)
  1799.                     FlushLog(screen);
  1800.                 if((Tbcnt = read(screen->respond,
  1801.                  Tbptr = Tbuffer, BUF_SIZE)) < 0) {
  1802.                     if(errno == EIO && am_slave)
  1803.                         exit(0);
  1804.                     else if(errno != EWOULDBLOCK)
  1805.                         Panic(
  1806.                  "Tinput:read returned unexpected error (%d)\n",
  1807.                          errno);
  1808.                 } else if(Tbcnt == 0)
  1809.                     Panic("input: read returned zero\n");
  1810.                 else {
  1811.                     if(screen->icon_show
  1812.                        && !screen->iconinput) {
  1813.                         screen->iconinput = TRUE;
  1814.                         IconBox(screen);
  1815.                     }
  1816.                     /* strip parity bit */
  1817.                     for(i = Tbcnt, cp = Tbptr ; i > 0 ; i--)
  1818.                         *cp++ &= CHAR;
  1819.                     break;
  1820.                 }
  1821.             }
  1822.             if (Ttoggled && curstate == Talptable) {
  1823.                 TCursorToggle(TOGGLE);
  1824.                 Ttoggled = FALSE;
  1825.             }
  1826.             if(QLength())
  1827.                 Tselect_mask = X_mask;
  1828.             else {
  1829.                 XFlush();
  1830.                 Tselect_mask = Select_mask;
  1831.                 if((i = select(max_plus1, &Tselect_mask, NULL,
  1832.                  NULL, screen->timeout)) < 0){
  1833.                     if (errno != EINTR)
  1834.                         SysError(ERROR_TSELECT);
  1835.                     continue;
  1836.                 } else if(i == 0) {
  1837.                     if(GetButtonState(screen->sb) & HILITED)
  1838.                         WindowScroll(screen,
  1839.                          ButtonRegion(screen->sb));
  1840.                     screen->timeout->tv_usec = STEPTIME;
  1841.                     continue;
  1842.                 }
  1843.             }
  1844.             if(Tselect_mask & X_mask) {
  1845.                 xevents();
  1846.                 if(Tbcnt > 0)
  1847.                     goto again;
  1848.             }
  1849.         }
  1850.         Tbcnt--;
  1851.         if (!Ttoggled && curstate == Talptable) {
  1852.             TCursorToggle(TOGGLE);
  1853.             Ttoggled = TRUE;
  1854.         }
  1855.     }
  1856.     if((tek = TekRecord)->count >= TEK_LINK_BLOCK_SIZE) {
  1857.         if((TekRecord = tek->next = (TekLink *)malloc(sizeof(TekLink)))
  1858.          == (TekLink *)0)
  1859.             Panic("Tinput: malloc error (%d)\n", errno);
  1860.         tek = tek->next;
  1861.         tek->next = (TekLink *)0;
  1862.         tek->count = 0;
  1863.         tek->ptr = tek->data;
  1864.     }
  1865.     tek->count++;
  1866.     return(*tek->ptr++ = *Tbptr++);
  1867. }
  1868.  
  1869. TekExpose(rep)
  1870. register XExposeWindowEvent *rep;
  1871. {
  1872.     register Screen *screen = &term.screen;
  1873.     register int border = 2 * screen->border;
  1874.     register double d;
  1875.  
  1876.     if(rep && (screen->mappedTwin == &screen->fullTwin)) {
  1877.         if (rep->width != (TWidth(screen) + border) || rep->height !=
  1878.          (THeight(screen) + border + TTitlebar(screen))) {
  1879.             XClear (TWindow(screen));
  1880.             TWidth(screen) = rep->width - border;
  1881.             THeight(screen) = rep->height - TTitlebar(screen)
  1882.              - border;
  1883.             TekScale(screen) = (double)TWidth(screen) /
  1884.              (TEKWIDTH + TEKPAD);
  1885.             if((d = (double)THeight(screen) / (TEKHEIGHT +
  1886.              TEKTOPPAD + TEKBOTTOMPAD)) < TekScale(screen))
  1887.                 TekScale(screen) = d;
  1888.             if(TTitlebar(screen) && TFullWidth(screen) !=
  1889.              rep->width)
  1890.                 TekTitleResize(rep->width);
  1891.             TFullWidth(screen) = rep->width;
  1892.             TFullHeight(screen) = rep->height;
  1893.             if (screen->active_icon)
  1894.                 TSetIconSize( screen );
  1895.  
  1896.         } else if(TFullHeight(screen) != rep->height)
  1897.             TFullHeight(screen) = rep->height;
  1898.         else if(!Ttoggled)
  1899.             TCursorToggle(CLEAR);
  1900.     }
  1901.     Ttoggled = TRUE;
  1902.     Tpushback = Tpushb;
  1903.     screen->cur_X = 0;
  1904.     screen->cur_Y = TEKHOME;
  1905.     screen->cur = screen->page;
  1906.     screen->margin = MARGIN1;
  1907.     if(screen->TekGIN) {
  1908.         screen->TekGIN = NULL;
  1909.         TekGINoff();
  1910.     }
  1911.     TekRefresh = &Tek0;
  1912.     rptr = TekRefresh->data;
  1913.     rcnt = TekRefresh->count;
  1914.     Tparsestate = curstate = Talptable;
  1915.     if(!screen->waitrefresh)
  1916.         dorefresh();
  1917. }
  1918.  
  1919. dorefresh()
  1920. {
  1921.     register Screen *screen = &term.screen;
  1922.     register Cursor cur;
  1923.  
  1924.     XDefineCursor(TWindow(screen), cur = make_wait(screen->mousecolor,
  1925.      screen->background, GXcopy));
  1926.     XFlush();
  1927.     if(!setjmp(Tekjump))
  1928.         Tekparse();
  1929.     XDefineCursor(TWindow(screen), (screen->TekGIN && GINcursor) ?
  1930.      GINcursor : screen->arrow);
  1931.     XFreeCursor(cur);
  1932. }
  1933.  
  1934. TekPage()
  1935. {
  1936.     register Screen *screen = &term.screen;
  1937.     register TekLink *tek, *tek2;
  1938.  
  1939.     XClear(TWindow(screen));
  1940.     screen->cur_X = 0;
  1941.     screen->cur_Y = TEKHOME;
  1942.     screen->margin = MARGIN1;
  1943.     screen->page = screen->cur;
  1944.     if(screen->TekGIN)
  1945.         TekGINoff();
  1946.     tek = TekRecord = &Tek0;
  1947.     tek->count = 0;
  1948.     tek->ptr = tek->data;
  1949.     if(tek = tek->next)
  1950.         do {
  1951.             tek2 = tek->next;
  1952.             free((char *)tek);
  1953.         } while(tek = tek2);
  1954.     TekRecord->next = (TekLink *)0;
  1955.     TekRefresh = (TekLink *)0;
  1956.     Ttoggled = TRUE;
  1957.     Tparsestate = curstate = Talptable;    /* Tek Alpha mode */
  1958. }
  1959.  
  1960. #define    EXTRABITS    017
  1961. #define    FIVEBITS    037
  1962. #define    HIBITS        (FIVEBITS << SHIFTHI)
  1963. #define    LOBITS        (FIVEBITS << SHIFTLO)
  1964. #define    SHIFTHI        7
  1965. #define    SHIFTLO        2
  1966. #define    TWOBITS        03
  1967.  
  1968. getpoint()
  1969. {
  1970.     register int c, x, y, e, lo_y = 0;
  1971.     register Screen *screen = &term.screen;
  1972.  
  1973.     x = screen->cur.x;
  1974.     y = screen->cur.y;
  1975.     for( ; ; ) {
  1976.         if((c = input()) < ' ') {    /* control character */
  1977.             unput(c);
  1978.             return(0);
  1979.         }
  1980.         if(c < '@') {    /* Hi X or Hi Y */
  1981.             if(lo_y) {    /* seen a Lo Y, so this must be Hi X */
  1982.                 x &= ~HIBITS;
  1983.                 x |= (c & FIVEBITS) << SHIFTHI;
  1984.                 continue;
  1985.             }
  1986.             /* else Hi Y */
  1987.             y &= ~HIBITS;
  1988.             y |= (c & FIVEBITS) << SHIFTHI;
  1989.             continue;
  1990.         }
  1991.         if(c < '`') {    /* Lo X */
  1992.             x &= ~LOBITS;
  1993.             x |= (c & FIVEBITS) << SHIFTLO;
  1994.             screen->cur.x = x;
  1995.             screen->cur.y = y;
  1996.             return(1);    /* OK */
  1997.         }
  1998.         /* else Lo Y */
  1999.         if(lo_y) {    /* seen a Lo Y, so other must be extra bits */
  2000.             e = (y >> SHIFTLO) & EXTRABITS;
  2001.             x &= ~TWOBITS;
  2002.             x |= e & TWOBITS;
  2003.             y &= ~TWOBITS;
  2004.             y |= (e >> SHIFTLO) & TWOBITS;
  2005.         }
  2006.         y &= ~LOBITS;
  2007.         y |= (c & FIVEBITS) << SHIFTLO;
  2008.         lo_y++;
  2009.     }
  2010. }
  2011.  
  2012. TCursorBack()
  2013. {
  2014.     register Screen *screen = &term.screen;
  2015.     register struct Tek_Char *t;
  2016.     register int x, l;
  2017.  
  2018.     x = ( screen->cur_X -=
  2019.         ( t = &TekChar[TActiveIcon(screen)
  2020.                    ? ICONFONT
  2021.                    : screen->cur.fontsize]
  2022.         )->hsize
  2023.         );
  2024.  
  2025.     if(screen->margin == MARGIN1 && x < 0 || screen->margin == MARGIN2
  2026.      && x < TEKWIDTH / 2) {
  2027.         if((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >=
  2028.          t->nlines) {
  2029.             screen->margin = !screen->margin;
  2030.             l = 0;
  2031.         }
  2032.         screen->cur_Y = l * t->vsize;
  2033.         screen->cur_X = (t->charsperline - 1) * t->hsize;
  2034.     }
  2035. }
  2036.  
  2037. TCursorForward()
  2038. {
  2039.     register Screen *screen = &term.screen;
  2040.     register struct Tek_Char *t;
  2041.     register int l;
  2042.  
  2043.     if( ( screen->cur_X +=
  2044.         ( t = &TekChar[TActiveIcon(screen)
  2045.                    ? ICONFONT
  2046.                    : screen->cur.fontsize]
  2047.         )->hsize
  2048.         ) > TEKWIDTH
  2049.       ) {
  2050.         if((l = screen->cur_Y / t->vsize - 1) < 0) {
  2051.             screen->margin = !screen->margin;
  2052.             l = t->nlines - 1;
  2053.         }
  2054.         screen->cur_Y = l * t->vsize;
  2055.         screen->cur_X = screen->margin == MARGIN1 ? 0 : TEKWIDTH / 2;
  2056.     }
  2057. }
  2058.  
  2059. TCursorUp()
  2060. {
  2061.     register Screen *screen = &term.screen;
  2062.     register struct Tek_Char *t;
  2063.     register int l;
  2064.  
  2065.     t = &TekChar[TActiveIcon(screen)
  2066.              ? ICONFONT
  2067.              : screen->cur.fontsize];
  2068.  
  2069.     if((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= t->nlines) {
  2070.         l = 0;
  2071.         if((screen->margin = !screen->margin) != MARGIN1) {
  2072.             if(screen->cur_X < TEKWIDTH / 2)
  2073.                 screen->cur_X += TEKWIDTH / 2;
  2074.         } else if(screen->cur_X >= TEKWIDTH / 2)
  2075.             screen->cur_X -= TEKWIDTH / 2;
  2076.     }
  2077.     screen->cur_Y = l * t->vsize;
  2078. }
  2079.  
  2080. TCursorDown()
  2081. {
  2082.     register Screen *screen = &term.screen;
  2083.     register struct Tek_Char *t;
  2084.     register int l;
  2085.  
  2086.     t = &TekChar[TActiveIcon(screen)
  2087.              ? ICONFONT
  2088.              : screen->cur.fontsize];
  2089.  
  2090.     if((l = screen->cur_Y / t->vsize - 1) < 0) {
  2091.         l = t->nlines - 1;
  2092.         if((screen->margin = !screen->margin) != MARGIN1) {
  2093.             if(screen->cur_X < TEKWIDTH / 2)
  2094.                 screen->cur_X += TEKWIDTH / 2;
  2095.         } else if(screen->cur_X >= TEKWIDTH / 2)
  2096.             screen->cur_X -= TEKWIDTH / 2;
  2097.     }
  2098.     screen->cur_Y = l * t->vsize;
  2099. }
  2100.  
  2101. TekDraw (x, y)
  2102. int x, y;
  2103. {
  2104.     register Screen *screen = &term.screen;
  2105.  
  2106.     if(nplot == 0 || T_lastx != screen->cur_X || T_lasty != screen->cur_Y) {
  2107.         /*
  2108.          * We flush on each unconnected line segment if the line
  2109.          * type is not solid.  This solves a bug in X when drawing
  2110.          * points while the line type is not solid.
  2111.          */
  2112.         if(nplot > 0 && screen->cur.linetype != SOLIDLINE)
  2113.             TekFlush();
  2114.         AddToDraw(VertexDontDraw, screen->cur_X, screen->cur_Y);
  2115.     }
  2116.     T_lastx = screen->cur_X = x;
  2117.     T_lasty = screen->cur_Y = y;
  2118.     AddToDraw(VertexDrawLastPoint, x, y);
  2119. }
  2120.  
  2121. AddToDraw(type, x, y)
  2122. int type, x, y;
  2123. {
  2124.     register Screen *screen = &term.screen;
  2125.     register int last;
  2126.     register Vertex *lp;
  2127.  
  2128.     if(nplot >= MAX_PTS) {
  2129.         if(Tline[last = nplot - 1].flags == VertexDontDraw)
  2130.             nplot--;
  2131.         TekFlush();
  2132.         if(type != VertexDontDraw) {
  2133.             *line_pt = Tline[last];
  2134.             (line_pt++)->flags = VertexDontDraw;
  2135.             nplot++;
  2136.         }
  2137.     }
  2138.     lp = line_pt++;
  2139.     lp->flags = type;
  2140.     lp->x = x = x * TekScale(screen) + screen->border;
  2141.     lp->y = y = (TEKHEIGHT + TEKTOPPAD - y) * TekScale(screen) +
  2142.      screen->border + TTitlebar(screen);
  2143.     nplot++;
  2144. }
  2145.  
  2146. TekFlush ()
  2147. {
  2148.     register Screen *screen = &term.screen;
  2149.  
  2150.     if(screen->cur.linetype == SOLIDLINE)
  2151.         XDraw (TWindow(screen), Tline, nplot, 1, 1, screen->Tforeground,
  2152.          GXcopy, AllPlanes);
  2153.     else
  2154.         XDrawDashed (TWindow(screen), Tline, nplot, 1, 1,
  2155.          screen->Tforeground, screen->linepat[screen->cur.linetype - 1],
  2156.          GXcopy, AllPlanes);
  2157.     nplot = 0;
  2158.     line_pt = Tline;
  2159. }
  2160.  
  2161. TekGINoff()
  2162. {
  2163.     register Screen *screen = &term.screen;
  2164.     
  2165.     XDefineCursor(TWindow(screen), screen->arrow);
  2166.     if(GINcursor)
  2167.         XFreeCursor(GINcursor);
  2168.     if(screen->TekGIN) {
  2169.         *screen->TekGIN = CANCEL;    /* modify recording */
  2170.         screen->TekGIN = NULL;
  2171.     }
  2172. }
  2173.  
  2174. TekEnqMouse(c)
  2175. int c;
  2176. {
  2177.     register Screen *screen = &term.screen;
  2178.     int mousex, mousey;
  2179.     Window subw;
  2180.  
  2181.     XUpdateMouse(TWindow(screen), &mousex, &mousey, &subw);
  2182.     if((mousex = (mousex - screen->border) / TekScale(screen)) < 0)
  2183.         mousex = 0;
  2184.     else if(mousex >= TEKWIDTH)
  2185.         mousex = TEKWIDTH - 1;
  2186.     if((mousey = TEKHEIGHT + TEKTOPPAD - (mousey - screen->border -
  2187.      TTitlebar(screen)) / TekScale(screen)) < 0)
  2188.         mousey = 0;
  2189.     else if(mousey >= TEKHEIGHT)
  2190.         mousey = TEKHEIGHT - 1;
  2191.     TekEnq(c, mousex, mousey);
  2192. }
  2193.  
  2194. TekEnq (status, x, y)
  2195. int status;
  2196. register int x, y;
  2197. {
  2198.     register Screen *screen = &term.screen;
  2199.     int pty = screen->respond;
  2200.     char cplot [5];
  2201.  
  2202.     /* Translate x and y to Tektronix code */
  2203.     cplot[1] = 040 | ((x >> SHIFTHI) & FIVEBITS);
  2204.     cplot[2] = 040 | ((x >> SHIFTLO) & FIVEBITS);
  2205.     cplot[3] = 040 | ((y >> SHIFTHI) & FIVEBITS);
  2206.     cplot[4] = 040 | ((y >> SHIFTLO) & FIVEBITS);
  2207.     if(cplot[0] = status)
  2208.         write (pty, cplot, 5);
  2209.     else
  2210.         write (pty, &cplot[1], 4);
  2211. }
  2212.  
  2213. TekRun()
  2214. {
  2215.     register Screen *screen = &term.screen;
  2216.     register int i;
  2217.     
  2218.     if(!TWindow(screen) && !TekInit()) {
  2219.         if(VWindow(screen)) {
  2220.             screen->TekEmu = FALSE;
  2221.             return;
  2222.         }
  2223.         Exit(ERROR_TINIT);
  2224.     }
  2225.     if(screen->icon_show) {
  2226.         if(screen->icon_show < 0) {
  2227.             screen->mappedTwin = &screen->iconTwin;
  2228.             screen->icon_show = TRUE;
  2229.             XMapWindow(TWindow(screen));
  2230.         }
  2231.     } else if(!screen->Tshow) {
  2232.         screen->mappedTwin = &screen->fullTwin;
  2233.         screen->Tshow = TRUE;
  2234.         XMapWindow(TWindow(screen));
  2235.     } else
  2236.         XRaiseWindow(TWindow(screen));
  2237.     if(screen->select)
  2238.         TekSelect();
  2239.     if (L_flag > 0) {
  2240.         XWarpMouse (TWindow(screen),
  2241.                 TFullWidth(screen) >> 1, TFullHeight(screen) >> 1);
  2242.         L_flag = -1;
  2243.     }
  2244.     Tpushback = Tpushb;
  2245.     Tbptr = Tbuffer;
  2246.     for(i = Tbcnt = bcnt ; i > 0 ; i--)
  2247.         *Tbptr++ = *bptr++;
  2248.     Tbptr = Tbuffer;
  2249.     Ttoggled = TRUE;
  2250.     if(!setjmp(Tekend))
  2251.         Tekparse();
  2252.     if(!Ttoggled) {
  2253.         TCursorToggle(TOGGLE);
  2254.         Ttoggled = TRUE;
  2255.     }
  2256.     screen->TekEmu = FALSE;
  2257.     TekUnselect();
  2258. }
  2259.  
  2260. static int Tpattern[TEKNUMLINES] = {
  2261.     XMakePattern(0x1, 4, 1),    /* dotted */
  2262.     XMakePattern(0xf1, 11, 1),    /* dot-dashed */
  2263.     XMakePattern(0xf, 8, 1),    /* short-dashed */
  2264.     XMakePattern(0x7f, 11, 1),    /* long-dashed */
  2265. };
  2266.  
  2267. TekInit()
  2268. {
  2269.     register Screen *screen = &term.screen;
  2270.     register int i, j;
  2271.     register TekLink *tek;
  2272.     register int width, height;
  2273.     register double d;
  2274.     register int border = 2 * screen->border;
  2275.     OpaqueFrame twindow;
  2276.     FontInfo finfo, ifinfo;
  2277.     char Tdefault[32];
  2278.     char iconname[128];
  2279.     WindowInfo wininfo;
  2280.     Color cdef;
  2281.     int pixels[2];
  2282.     static short Tfailed;
  2283.     int x, y;
  2284.     Window win;
  2285.     extern char *malloc();
  2286.  
  2287.     screen->mappedTwin = &screen->fullTwin;
  2288.  
  2289.     if(Tfailed)
  2290.         return(0);
  2291.     if (!(screen->Tfont[SMALLFONT] = XGetFont(SMALLFONTNAME))) {
  2292.         fprintf(stderr, "%s: Could not get font %s!\n",
  2293.             xterm_name, SMALLFONTNAME);
  2294.         goto fontfailed;
  2295.     }
  2296.     if((Tbuffer = (char *)malloc(BUF_SIZE)) == NULL ||
  2297.      (Tpushb = (char *)malloc(10)) == NULL ||
  2298.      (Tline = (Vertex *)malloc(MAX_VTX * sizeof(Vertex))) == NULL) {
  2299.         fprintf(stderr, "%s: Not enough core for Tek mode\n",
  2300.          xterm_name);
  2301.         goto mallocfailed;
  2302.     }
  2303.  
  2304.     screen->xorplane = 1;
  2305.     screen->Tbackground = W_Pixel;
  2306.     screen->Tforeground = B_Pixel;
  2307.     screen->Tcursorcolor = B_Pixel;
  2308.  
  2309.     if (DisplayCells() > 2 && (fore_color || back_color ||
  2310.      curs_color)) {
  2311.         if (curs_color && XParseColor(curs_color, &cdef)) {
  2312.             if(XGetColorCells(0, 2, 1, &screen->xorplane, pixels)) {
  2313.                 screen->cellsused = TRUE;
  2314.                 screen->colorcells[2] = cdef;
  2315.                 screen->Tbackground = pixels[0];
  2316.                 screen->Tforeground = pixels[1];
  2317.                 screen->Tcursorcolor = screen->Tbackground |
  2318.                  screen->xorplane;
  2319.                 screen->Tcolor |= C_CURSOR;
  2320.                 screen->planeused = TRUE;
  2321.             }
  2322.         } else if (XGetColorCells(0, 1, 1, &screen->xorplane,
  2323.          &screen->Tbackground)) {
  2324.             screen->Tforeground = screen->Tbackground |
  2325.              screen->xorplane;
  2326.             screen->Tcursorcolor = screen->Tforeground;
  2327.             screen->planeused = TRUE;
  2328.         }
  2329.         if (screen->Tbackground != W_Pixel) {
  2330.             if (back_color == NULL ||
  2331.                 !XParseColor(back_color, &cdef)) {
  2332.                 cdef.pixel = W_Pixel;
  2333.                 XQueryColor(&cdef);
  2334.                 screen->Tcolor |= C_BACKGROUND;
  2335.             }
  2336.             cdef.pixel = screen->Tbackground;
  2337.             XStoreColor(&cdef);
  2338.             if(screen->cellsused) {
  2339.                 screen->colorcells[0] = cdef;
  2340.                 cdef.pixel = screen->Tforeground |
  2341.                     screen->xorplane;
  2342.                 XStoreColor(&cdef);
  2343.             }
  2344.             if (fore_color == NULL ||
  2345.                 !XParseColor(fore_color, &cdef)) {
  2346.                 cdef.pixel = B_Pixel;
  2347.                 XQueryColor(&cdef);
  2348.                 screen->Tcolor |= C_FOREGROUND;
  2349.             }
  2350.             cdef.pixel = screen->Tforeground;
  2351.             XStoreColor(&cdef);
  2352.             if(screen->cellsused) {
  2353.                 screen->colorcells[1] = cdef;
  2354.                 cdef.pixel = screen->Tcursorcolor;
  2355.                 XStoreColor(&cdef);
  2356.             }
  2357.         }
  2358.     }
  2359.     if(term.flags & REVERSE_VIDEO) {
  2360.         screen->Tbgndtile = NULL;
  2361.         TekReverseVideo(screen);
  2362.     } else
  2363.         TekBackground(screen);
  2364.  
  2365.     twindow.bdrwidth = screen->borderwidth;
  2366.     twindow.border = screen->graybordertile;
  2367.     twindow.background = screen->Tbgndtile;
  2368.  
  2369.     sprintf(Tdefault, "=%dx%d+1+1", TEKDEFWIDTH + border, TEKDEFHEIGHT +
  2370.      TTitlebar(screen) + border);
  2371.     if((TWindow(screen) = XCreate ("Tektronix Emulator", xterm_name,
  2372.      T_geometry, Tdefault, &twindow, TEKMINWIDTH + border, TEKMINHEIGHT +
  2373.      TTitlebar(screen) + border)) == NULL) {
  2374.         fprintf(stderr, "%s: Can't create Tek window\n", xterm_name);
  2375.         free((char *)Tline);
  2376. mallocfailed:
  2377.         if(Tpushb)
  2378.             free((char *)Tpushb);
  2379.         if(Tbuffer)
  2380.             free((char *)Tbuffer);
  2381.         XFreeFont(screen->Tfont[SMALLFONT]);
  2382. fontfailed:
  2383.         Tfailed = TRUE;
  2384.         return(FALSE);
  2385.     }
  2386.     XSelectInput(TWindow(screen), TWINDOWEVENTS);
  2387.     screen->Tbox = T_box;
  2388.     /*
  2389.      * XCreate flushes all events, which might include an EnterWindow
  2390.      * or LeaveWindow.  So if the cursor is not where it is supposed to
  2391.      * be, we set select to the appropriate thing.
  2392.      */
  2393.     if(VWindow(screen) && XQueryMouse(RootWindow, &x, &y, &win)) {
  2394.         if(screen->timer) {
  2395.             Timer(0L);
  2396.             screen->timer = 0;
  2397.         }
  2398.         if(win == VWindow(screen))
  2399.             screen->select |= INWINDOW;
  2400.         else
  2401.             screen->select &= ~INWINDOW;
  2402.     }
  2403.  
  2404.     TFullWidth(screen) = twindow.width;
  2405.     TFullHeight(screen) = twindow.height;
  2406.     TWidth(screen) = twindow.width - border;
  2407.     THeight(screen) = twindow.height - TTitlebar(screen) - border;
  2408.     TekScale(screen) = (double)TWidth(screen)
  2409.                     / (TEKWIDTH + TEKPAD);
  2410.     if((d = (double)THeight(screen) / (TEKHEIGHT + TEKTOPPAD +
  2411.      TEKBOTTOMPAD)) < TekScale(screen))
  2412.         TekScale(screen) = d;
  2413.  
  2414.  
  2415.     XQueryFont(screen->Tfont[SMALLFONT], &finfo);
  2416.     screen->tobaseline[SMALLFONT] = finfo.height - finfo.baseline;
  2417.  
  2418.     if (!(screen->Tfont[THREEFONT] = XGetFont(THREEFONTNAME)))
  2419.         screen->Tfont[THREEFONT] = screen->Tfont[SMALLFONT];
  2420.     else
  2421.         XQueryFont(screen->Tfont[THREEFONT], &finfo);
  2422.     screen->tobaseline[THREEFONT] = finfo.height - finfo.baseline;
  2423.  
  2424.     if (!screen->fnt_icon)
  2425.         screen->fnt_icon = XGetFont( f_i );
  2426.  
  2427.     screen->Tfont[ICONFONT] = screen->fnt_icon;
  2428.     XQueryFont( screen->fnt_icon, &ifinfo );
  2429.     Tfontsize[ICONFONT].Twidth = ifinfo.width;
  2430.     Tfontsize[ICONFONT].Theight = ifinfo.height;
  2431.     screen->tobaseline[ICONFONT] = ifinfo.height - ifinfo.baseline;
  2432.     T_boxicon[1].x = ifinfo.width - 1;
  2433.     T_boxicon[2].y = ifinfo.height - 1;
  2434.     T_boxicon[3].x = -ifinfo.width + 1;
  2435.     T_boxicon[4].y = -ifinfo.height + 1;
  2436.  
  2437.     if (!(screen->Tfont[TWOFONT] = XGetFont(TWOFONTNAME)))
  2438.         screen->Tfont[TWOFONT] = screen->Tfont[THREEFONT];
  2439.     else
  2440.         XQueryFont(screen->Tfont[TWOFONT], &finfo);
  2441.     screen->tobaseline[TWOFONT] = finfo.height - finfo.baseline;
  2442.  
  2443.     if (!(screen->Tfont[LARGEFONT] = XGetFont(LARGEFONTNAME)))
  2444.         screen->Tfont[LARGEFONT] = screen->Tfont[TWOFONT];
  2445.     else
  2446.         XQueryFont(screen->Tfont[LARGEFONT], &finfo);
  2447.     screen->tobaseline[LARGEFONT] = finfo.height - finfo.baseline;
  2448.  
  2449.     for(i = 0 ; i < TEKNUMLINES ; i++)
  2450.         screen->linepat[i] = Tpattern[i];
  2451.     screen->margin = MARGIN1;        /* Margin 1        */
  2452.     screen->cur.fontsize = LARGEFONT;    /* set large font    */
  2453.     screen->TekGIN = FALSE;            /* GIN off        */
  2454.  
  2455.     if(screen->iconVwin.window) {
  2456.         XQueryWindow(screen->iconVwin.window, &wininfo);
  2457.         x = wininfo.x;
  2458.         y = wininfo.y;
  2459.     } else {
  2460.         x = twindow.x + (twindow.width - screen->iconTwin.width) / 2;
  2461.         y = twindow.y + (twindow.height - screen->iconTwin.height) / 2;
  2462.         IconGeometry(screen, &x, &y);
  2463.     }
  2464.     screen->iconTwin.window =
  2465.         XCreateWindow( RootWindow, x, y, 1, 1, screen->borderwidth,
  2466.                    screen->bordertile, screen->bgndtile );
  2467.  
  2468.     TSetIconSize( screen );
  2469.     XSetIconWindow( screen->fullTwin.window, screen->iconTwin.window );
  2470.  
  2471.     XDefineCursor( screen->iconTwin.window, screen->arrow );
  2472.     XSelectInput( screen->iconTwin.window,
  2473.               screen->active_icon && (term.flags & ICONINPUT)
  2474.             ? TICONWINDOWEVENTS | ICONINPUTEVENTS
  2475.             : TICONWINDOWEVENTS );
  2476.  
  2477.     XDefineCursor( TWindow(screen), screen->curs );
  2478.     if((screen->Twinname = malloc(screen->winnamelen + 6)) == NULL)
  2479.         Error(ERROR_TWINNAME);
  2480.     strcpy(screen->Twinname, screen->winname);
  2481.     strcat(screen->Twinname, " (Tek)");
  2482.     screen->Twinnamelen = strlen(screen->Twinname);
  2483.     XStoreName (TWindow(screen), screen->Twinname);
  2484.     strcpy(iconname, screen->winname);
  2485.     strcat(iconname, " (icon)");
  2486.     XStoreName (screen->iconTwin.window, iconname);
  2487.     XSetResizeHint (TWindow(screen), TEKMINWIDTH + border, TEKMINHEIGHT
  2488.      + border + TTitlebar(screen), 1, 1);
  2489.  
  2490.     tek = TekRecord = &Tek0;
  2491.     tek->next = (TekLink *)0;
  2492.     tek->count = 0;
  2493.     tek->ptr = tek->data;
  2494.     Tpushback = Tpushb;
  2495.     screen->cur_X = 0;
  2496.     screen->cur_Y = TEKHOME;
  2497.     line_pt = Tline;
  2498.     Ttoggled = TRUE;
  2499.     if(TTitlebar(screen))
  2500.         TekTitleShow(TRUE);
  2501.     Tparsestate = curstate = Talptable;
  2502.     return(TRUE);
  2503. }
  2504.  
  2505. TekReverseVideo(screen)
  2506. register Screen *screen;
  2507. {
  2508.     register int flag, i;
  2509.  
  2510.     if(screen->Tbgndtile && ((screen->Tcolor & C_BACKGROUND) ||
  2511.      screen->planeused))
  2512.         XFreePixmap(screen->Tbgndtile);
  2513.     i = screen->Tbackground;
  2514.     screen->Tbackground = screen->Tforeground;
  2515.     screen->Tforeground = i;
  2516.     screen->Tcolor = (screen->Tcolor & ~C_FBMASK) | switchfb[screen->Tcolor
  2517.      & C_FBMASK];
  2518.  
  2519.     if(screen->cellsused) {
  2520.         flag = (term.flags & REVERSE_VIDEO) != 0;
  2521.         screen->Tcursorcolor = screen->Tbackground | screen->xorplane;
  2522.         i = screen->select ? 2 : !flag;
  2523.         screen->colorcells[i].pixel = screen->Tcursorcolor;
  2524.         XStoreColor(&screen->colorcells[i]);
  2525.         screen->colorcells[flag].pixel = screen->Tforeground |
  2526.          screen->xorplane;
  2527.         XStoreColor(&screen->colorcells[flag]);
  2528.     } else
  2529.         screen->Tcursorcolor = screen->Tforeground;
  2530.     TekBackground(screen);
  2531. }
  2532.  
  2533. TekBackground(screen)
  2534. register Screen *screen;
  2535. {
  2536.     if((screen->Tcolor & C_BACKGROUND) || screen->planeused) {
  2537.         if(!(screen->Tbgndtile = XMakeTile(screen->Tbackground)))
  2538.             Error(ERROR_TBACK);
  2539.     } else
  2540.         screen->Tbgndtile = (screen->Tbackground == W_Pixel) ? W_Pixmap
  2541.          : B_Pixmap;
  2542.     if(TWindow(screen))
  2543.         XChangeBackground(TWindow(screen), screen->Tbgndtile);
  2544. }
  2545.  
  2546. /*
  2547.  * Toggles cursor on or off at cursor position in screen.
  2548.  */
  2549. TCursorToggle(toggle)
  2550. int toggle;
  2551. {
  2552.     register Screen *screen = &term.screen;
  2553.     register int c, x, y;
  2554.     register T_fontsize *Tf;
  2555.     register int pixel, func, planes;
  2556.  
  2557.     if (screen->icon_show && !screen->active_icon) return;
  2558.  
  2559.     if(toggle) {
  2560.         pixel = screen->Tcursorcolor;
  2561.         func = GXinvert;
  2562.         planes = screen->xorplane;
  2563.     } else {
  2564.         pixel = screen->Tbackground;
  2565.         func = GXcopy;
  2566.         planes = AllPlanes;
  2567.     }
  2568.  
  2569.     c = TActiveIcon(screen)
  2570.         ? ICONFONT
  2571.         : screen->cur.fontsize;
  2572.  
  2573.     x = (screen->cur_X * TekScale(screen)) + screen->border;
  2574.     y = ((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) +
  2575.      screen->border - screen->tobaseline[c] + TTitlebar(screen);
  2576.     if(!toggle || screen->select) {
  2577.         Tf = &Tfontsize[c];
  2578.         XPixFill(TWindow(screen), x, y, Tf->Twidth, Tf->Theight, pixel,
  2579.          (Bitmap)0, func, planes);
  2580.     } else {
  2581.         screen->Tbox[c]->x = x;
  2582.         screen->Tbox[c]->y = y;
  2583.         XDraw(TWindow(screen), screen->Tbox[c], NBOX, 1, 1, pixel,
  2584.          func, planes);
  2585.     }
  2586. }
  2587.  
  2588. TekSelect()
  2589. {
  2590.     register Screen *screen = &term.screen;
  2591.  
  2592.     if(screen->borderwidth > 0)
  2593.         XChangeBorder(TWindow(screen), screen->bordertile);
  2594.     if(TTitlebar(screen))
  2595.         TekTitleHilite();
  2596. }
  2597.  
  2598. TekUnselect()
  2599. {
  2600.     register Screen *screen = &term.screen;
  2601.  
  2602.     if(screen->borderwidth > 0)
  2603.         XChangeBorder(TWindow(screen), screen->graybordertile);
  2604.     if(TTitlebar(screen))
  2605.         TekTitleUnhilite();
  2606. }
  2607.  
  2608. TekCopy()
  2609. {
  2610.     register TekLink *Tp;
  2611.     register int fd;
  2612.     register Screen *screen = &term.screen;
  2613.     register char *cp;
  2614.     register struct tm *tp;
  2615.     long l;
  2616.     char buf[32];
  2617.  
  2618.     /* for login windows, check that a user has logged in */
  2619.     if(L_flag && !checklogin()) {
  2620.         Bell();
  2621.         return;
  2622.     }
  2623.     time(&l);
  2624.     tp = localtime(&l);
  2625.     sprintf(buf, "COPY%02d-%02d-%02d.%02d:%02d:%02d", tp->tm_year,
  2626.      tp->tm_mon, tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec);
  2627.     if(access(buf, F_OK) >= 0) {    /* file exists */
  2628.         if(access(buf, W_OK) < 0) {
  2629.             Bell();
  2630.             return;
  2631.         }
  2632.     } else if(access(".", W_OK) < 0) {    /* can't write in directory */
  2633.         Bell();
  2634.         return;
  2635.     }
  2636.     if((fd = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) {
  2637.         Bell();
  2638.         return;
  2639.     }
  2640.     chown(buf, screen->uid, screen->gid);
  2641.     sprintf(buf, "\033%c\033%c", screen->page.fontsize + '8',
  2642.      screen->page.linetype + '`');
  2643.     write(fd, buf, 4);
  2644.     Tp = &Tek0; 
  2645.     do
  2646.         write(fd, (char *)Tp->data, Tp->count);
  2647.     while(Tp = Tp->next);
  2648.     close(fd);
  2649. }
  2650.  
  2651. TekTitleShow(init)
  2652. int init;
  2653. {
  2654.     register Screen *screen = &term.screen;
  2655.     register int border = 2 * screen->border;
  2656.  
  2657.     if(!screen->Ttitle.tbar)
  2658.         TekTitleInit();
  2659.     if(!init) {
  2660.         XSetResizeHint (TWindow(screen), TEKMINWIDTH + border,
  2661.          TEKMINHEIGHT + border + TTitlebar(screen), 1, 1);
  2662.         XChangeWindow (TWindow(screen), TWidth(screen) + border,
  2663.          THeight(screen) + TTitlebar(screen) + border);
  2664.     }
  2665.     if(screen->select && screen->TekEmu)
  2666.         TekTitleHilite();
  2667.     else
  2668.         TekTitleUnhilite();
  2669.     XMapWindow(screen->Ttitle.tbar);
  2670. }
  2671.  
  2672. TekTitleHide()
  2673. {
  2674.     register Screen *screen = &term.screen;
  2675.     register int border = 2 * screen->border;
  2676.  
  2677.     XUnmapWindow(screen->Ttitle.tbar);
  2678.     XSetResizeHint (TWindow(screen), TEKMINWIDTH + border, TEKMINHEIGHT
  2679.      + border, 1, 1);
  2680.     XChangeWindow (TWindow(screen), TWidth(screen) + border,
  2681.      THeight(screen) + border);
  2682. }
  2683.  
  2684. TekTitleHilite()
  2685. {
  2686.     register Screen *screen = &term.screen;
  2687.  
  2688.     if(screen->Ttitle.hilited)
  2689.         return;
  2690.     XMapWindow(screen->Ttitle.left);
  2691.     XMapWindow(screen->Ttitle.right);
  2692.     screen->Ttitle.hilited = TRUE;
  2693. }
  2694.  
  2695. TekTitleUnhilite()
  2696. {
  2697.     register Screen *screen = &term.screen;
  2698.  
  2699.     if(!screen->Ttitle.hilited)
  2700.         return;
  2701.     XUnmapWindow(screen->Ttitle.left);
  2702.     XUnmapWindow(screen->Ttitle.right);
  2703.     screen->Ttitle.hilited = FALSE;
  2704. }
  2705.  
  2706. TekTitleResize(width)
  2707. register int width;
  2708. {
  2709.     register Screen *screen = &term.screen;
  2710.     register int i, j;
  2711.  
  2712.     if((screen->Ttitle.width = i = screen->Ttitle.fullwidth) >
  2713.      (j = width - 2 * (MINHILITE + screen->title_n_size + 1)))
  2714.         screen->Ttitle.width = (i = j) + screen->title_n_size;
  2715.     j = width - i - 2 * (screen->title_n_size + 1);
  2716.     i = j / 2;
  2717.     j -= i;
  2718.     screen->Ttitle.x = i + 1 + screen->title_n_size;
  2719.     XChangeWindow(screen->Ttitle.tbar, width, screen->titleheight - 1);
  2720.     XChangeWindow(screen->Ttitle.left, i, screen->titlefont->height);
  2721.     XConfigureWindow(screen->Ttitle.right, width - j - 1, TITLEPAD, j,
  2722.      screen->titlefont->height);
  2723. }
  2724.  
  2725. TekTitleExpose(rep)
  2726. register XExposeWindowEvent *rep;
  2727. {
  2728.     register Screen *screen = &term.screen;
  2729.  
  2730.     if(rep && (rep->x > (screen->Ttitle.x + screen->Ttitle.width) ||
  2731.      (rep->x + rep->width) < screen->Ttitle.x ||
  2732.      rep->y > (screen->Ttitle.y + screen->titlefont->height) ||
  2733.      (rep->y + rep->height) < screen->Ttitle.y))
  2734.         return;
  2735.     XText(screen->Ttitle.tbar, screen->Ttitle.x, screen->Ttitle.y,
  2736.      screen->Twinname, screen->Twinnamelen, screen->titlefont->id,
  2737.      screen->foreground, screen->background);
  2738. }
  2739.  
  2740. TekTitleInit()
  2741. {
  2742.     register Screen *screen = &term.screen;
  2743.     register int w, i, j;
  2744.     OpaqueFrame hilite[2];
  2745.     extern Pixmap make_hilite();
  2746.  
  2747.     if((screen->Ttitle.tbar = XCreateWindow(TWindow(screen), -1, -1,
  2748.      w = TFullWidth(screen), screen->titleheight - 1, 1, screen->bordertile,
  2749.      screen->bgndtile)) == NULL)
  2750.         Error(ERROR_TCRTITLE);
  2751.     XSelectInput(screen->Ttitle.tbar, ButtonPressed | ButtonReleased |
  2752.      ExposeWindow | EnterWindow | LeaveWindow | UnmapWindow);
  2753.     if(!screen->hilitetile && (screen->hilitetile =
  2754.      make_hilite(screen->foreground, screen->background)) == NULL)
  2755.         Error(ERROR_THILITE);
  2756.     screen->Ttitle.fullwidth = XQueryWidth(screen->Twinname,
  2757.      screen->titlefont->id);
  2758.     if((screen->Ttitle.width = i = screen->Ttitle.fullwidth) >
  2759.      (j = w - 2 * (MINHILITE + screen->title_n_size + 1)))
  2760.         screen->Ttitle.width = (i = j) + screen->title_n_size;
  2761.     j = w - i - 2 * (screen->title_n_size + 1);
  2762.     i = j / 2;
  2763.     j -= i;
  2764.     screen->Ttitle.x = i + 1 + screen->title_n_size;
  2765.     screen->Ttitle.y = TITLEPAD;
  2766.     hilite[0].x = 1;
  2767.     hilite[1].x = w - j - 1;
  2768.     hilite[0].y = hilite[1].y = TITLEPAD;
  2769.     hilite[0].width = i;
  2770.     hilite[1].width = j;
  2771.     hilite[0].height = hilite[1].height = screen->titlefont->height;
  2772.     hilite[0].bdrwidth = hilite[1].bdrwidth = 0;
  2773.     hilite[0].border = hilite[1].border = NULL;
  2774.     hilite[0].background = hilite[1].background = screen->hilitetile;
  2775.     if(XCreateWindows(screen->Ttitle.tbar, hilite, 2) != 2)
  2776.         Error(ERROR_TCRLFRG);
  2777.     screen->Ttitle.left = hilite[0].self;
  2778.     screen->Ttitle.right = hilite[1].self;
  2779. }
  2780.  
  2781. #ifdef MODEMENU
  2782. /*
  2783.  * TMENU_LARGE through TMENU_SMALL must be first, as they must be the same
  2784.  * as the font size values LARGEFONT through SMALLFONT
  2785.  */
  2786. #define    TMENU_LARGE    0
  2787. #define    TMENU_NUM2    (TMENU_LARGE+1)
  2788. #define    TMENU_NUM3    (TMENU_NUM2+1)
  2789. #define    TMENU_SMALL    (TMENU_NUM3+1)
  2790. #define    TMENU_VTWIN    (TMENU_SMALL+1)
  2791. #define    TMENU_LINE    (TMENU_VTWIN+1)
  2792. #define    TMENU_PAGE    (TMENU_LINE+1)
  2793. #define    TMENU_RESET    (TMENU_PAGE+1)
  2794. #define    TMENU_COPY    (TMENU_RESET+1)
  2795. #define    TMENU_VTMODE    (TMENU_COPY+1)
  2796. #define    TMENU_HIDETEK    (TMENU_VTMODE+1)
  2797.  
  2798. static char *Ttext[] = {
  2799.     "Large Characters",
  2800.     "#2 Size Characters",
  2801.     "#3 Size Characters",
  2802.     "Small Characters",
  2803.     "VT Window Showing",
  2804.     "-",
  2805.     "PAGE",
  2806.     "RESET",
  2807.     "COPY",
  2808.     "Select VT Mode",
  2809.     "Hide Tek Window",
  2810.     0,
  2811. };
  2812.  
  2813. static Tmodes curmodes;
  2814. static int Tsize;
  2815. static int vshow;
  2816.  
  2817. Menu *Tsetupmenu(menu)
  2818. register Menu **menu;
  2819. {
  2820.     register Screen *screen = &term.screen;
  2821.     register char **cp;
  2822.     register int size = TActiveIcon(screen)
  2823.                 ? ICONFONT
  2824.                 : screen->cur.fontsize;
  2825.     register int kflags = term.keyboard.flags;
  2826.  
  2827.     curmodes = screen->cur;
  2828.     if (*menu == NULL) {
  2829.         if ((*menu = NewMenu("Tektronix", re_verse)) == NULL)
  2830.             return(NULL);
  2831.         for(cp = Ttext ; *cp ; cp++)
  2832.             AddMenuItem(*menu, *cp);
  2833.         CheckItem(*menu, size);
  2834.         if(vshow = screen->show)
  2835.             CheckItem(*menu, TMENU_VTWIN);
  2836.         else
  2837.             DisableItem(*menu, TMENU_HIDETEK);
  2838.         DisableItem(*menu, TMENU_LINE);
  2839.         Tsize = size;
  2840.         return(*menu);
  2841.     }
  2842.     if (Tsize != size) {
  2843.         UncheckItem(*menu, Tsize);
  2844.         CheckItem(*menu, Tsize = size);
  2845.     }
  2846.     if(vshow != screen->show) {
  2847.         SetItemCheck(*menu, TMENU_VTWIN, (vshow = screen->show));
  2848.         SetItemDisable(*menu, TMENU_HIDETEK, !vshow);
  2849.     }
  2850.     return(*menu);
  2851. }
  2852.  
  2853. static char *changesize[] = {
  2854.     "\0338",
  2855.     "\0339",
  2856.     "\033:",
  2857.     "\033;",
  2858. };
  2859.  
  2860. Tdomenufunc(item)
  2861. int item;
  2862. {
  2863.     register Screen *screen = &term.screen;
  2864.     register char *tp;
  2865.     register char *fp;
  2866.     Window win;
  2867.     int x, y;
  2868.  
  2869.     switch (item) {
  2870.     case TMENU_LARGE:
  2871.     case TMENU_NUM2:
  2872.     case TMENU_NUM3:
  2873.     case TMENU_SMALL:
  2874.         if(!Ttoggled) {
  2875.             TCursorToggle(TOGGLE);
  2876.             Ttoggled = TRUE;
  2877.         }
  2878.         if(Tbcnt < 0)
  2879.             Tbcnt = 0;
  2880.         for(fp = changesize[item], tp = &Tbptr[Tbcnt] ; *fp ; ) {
  2881.             *tp++ = *fp++;
  2882.             Tbcnt++;
  2883.         }
  2884.         break;
  2885.  
  2886.     case TMENU_RESET:
  2887.         bzero((char *)&curmodes, sizeof(Tmodes));
  2888.             /* drop through */
  2889.     case TMENU_PAGE:
  2890.         TekRefresh = (TekLink *)0;
  2891.         screen->cur = curmodes;
  2892.         TekPage();
  2893.         screen->cur_X = 0;
  2894.         screen->cur_Y = TEKHOME;
  2895.         break;
  2896.  
  2897.     case TMENU_COPY:
  2898.         TekCopy();
  2899.         break;
  2900.  
  2901.     case TMENU_HIDETEK:
  2902.         screen->Tshow = FALSE;
  2903.         XUnmapWindow(TWindow(screen));
  2904.         SyncUnmap(TWindow(screen), TWINDOWEVENTS);
  2905.         reselectwindow(screen);
  2906.         TekRefresh = (TekLink *)0;
  2907.             /* drop through */
  2908.     case TMENU_VTMODE:
  2909.         if(TekRefresh)
  2910.             dorefresh();
  2911.         if(screen->TekEmu) {
  2912.             if(screen->logging) {
  2913.                 FlushLog(screen);
  2914.                 screen->logstart = buffer;
  2915.             }
  2916.             longjmp(Tekend, 1);
  2917.         } else
  2918.             XRaiseWindow(VWindow(screen));
  2919.         break;
  2920.  
  2921.     case TMENU_VTWIN:
  2922.         if(screen->show = !screen->show) {
  2923.             if(VWindow(screen) || VTInit()) {
  2924.                 XMapWindow(VWindow(screen));
  2925.                 screen->show = TRUE;
  2926.             }
  2927.         } else {
  2928.             screen->show = FALSE;
  2929.             XUnmapWindow(VWindow(screen));
  2930.             SyncUnmap(VWindow(screen), WINDOWEVENTS);
  2931.             if(!screen->TekEmu) {
  2932.                 if(TekRefresh)
  2933.                     dorefresh();
  2934.                 if(screen->logging) {
  2935.                     FlushLog(screen);
  2936.                     screen->logstart = Tbuffer;
  2937.                 }
  2938.                 screen->TekEmu = TRUE;
  2939.                 longjmp(VTend, 1);
  2940.             }
  2941.         }
  2942.         reselectwindow(screen);
  2943.         break;
  2944.     }
  2945.     if(TekRefresh)
  2946.         dorefresh();
  2947. }
  2948. #endif MODEMENU
  2949.  
  2950.  
  2951. TSetIconSize( screen )
  2952.   Screen *screen;
  2953. {
  2954.     double d;
  2955.  
  2956.     if (screen->active_icon) {
  2957.         screen->iconTwin.width = TWidth(screen)
  2958.                       * Tfontsize[ICONFONT].Twidth
  2959.                       / Tfontsize[THREEFONT].Twidth;
  2960.         screen->iconTwin.height = THeight(screen)
  2961.                       * Tfontsize[ICONFONT].Theight
  2962.                       / Tfontsize[THREEFONT].Theight;
  2963.         XChangeWindow( screen->iconTwin.window,
  2964.                screen->iconTwin.width,
  2965.                screen->iconTwin.height );
  2966.     } else
  2967.         IconRecalc( screen );
  2968.  
  2969.     screen->iconTwin.fullwidth = screen->iconTwin.width;
  2970.     screen->iconTwin.fullheight = screen->iconTwin.height;
  2971.     screen->iconTwin.tekscale = (double) screen->iconTwin.width
  2972.                     / (TEKWIDTH + TEKPAD);
  2973.  
  2974.     if ( (d = (double) screen->iconTwin.height
  2975.              / (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD)
  2976.          ) < screen->iconTwin.tekscale )
  2977.         screen->iconTwin.tekscale = d;
  2978. }
  2979. RAZZLE!DAZZLE
  2980. fi    # End Tekproc.c
  2981. if test -f main.h
  2982. then
  2983.     echo shar: will not overwrite existing file "'main.h'"
  2984. else
  2985. echo 'x - main.h'
  2986. cat << \RAZZLE!DAZZLE > main.h
  2987. /*
  2988.  *    $Source: /u1/X/xterm/RCS/main.h,v $
  2989.  *    $Header: main.h,v 10.100 86/12/01 14:39:34 jg Rel $
  2990.  */
  2991.  
  2992. /* @(#)main.h       X10/6.6B 12/28/86 */
  2993. #define DEF_ACTIVEICON        0
  2994. #define DEF_ALLOWICONINPUT    (DEF_ACTIVEICON+1)
  2995. #define    DEF_AUTORAISE        (DEF_ALLOWICONINPUT+1)
  2996. #define    DEF_BACKGROUND        (DEF_AUTORAISE+1)
  2997. #define    DEF_BODYFONT        (DEF_BACKGROUND+1)
  2998. #define    DEF_BOLDFONT        (DEF_BODYFONT+1)
  2999. #define    DEF_BORDER        (DEF_BOLDFONT+1)
  3000. #define    DEF_BORDERWIDTH        (DEF_BORDER+1)
  3001. #define    DEF_C132        (DEF_BORDERWIDTH+1)
  3002. #define    DEF_CURSES        (DEF_C132+1)
  3003. #define    DEF_CURSOR        (DEF_CURSES+1)
  3004. #define    DEF_DEICONWARP        (DEF_CURSOR+1)
  3005. #define    DEF_FOREGROUND        (DEF_DEICONWARP+1)
  3006. #define    DEF_ICONBITMAP        (DEF_FOREGROUND+1)
  3007. #define DEF_ICONFONT        (DEF_ICONBITMAP+1)
  3008. #define    DEF_ICONSTARTUP        (DEF_ICONFONT+1)
  3009. #define    DEF_INTERNALBORDER    (DEF_ICONSTARTUP+1)
  3010. #define    DEF_JUMPSCROLL        (DEF_INTERNALBORDER+1)
  3011.  
  3012. #ifdef KEYBD
  3013. #define    DEF_KEYBOARD        (DEF_JUMPSCROLL+1)
  3014. #define    DEF_LOGFILE        (DEF_KEYBOARD+1)
  3015. #else KEYBD
  3016. #define    DEF_LOGFILE        (DEF_JUMPSCROLL+1)
  3017. #endif KEYBD
  3018.  
  3019. #define    DEF_LOGGING        (DEF_LOGFILE+1)
  3020. #define    DEF_LOGINHIBIT        (DEF_LOGGING+1)
  3021. #define    DEF_LOGINSHELL        (DEF_LOGINHIBIT+1)
  3022. #define    DEF_MARGINBELL        (DEF_LOGINSHELL+1)
  3023. #define    DEF_MOUSE        (DEF_MARGINBELL+1)
  3024. #define    DEF_NMARGINBELL        (DEF_MOUSE+1)
  3025. #define    DEF_PAGEOVERLAP        (DEF_NMARGINBELL+1)
  3026. #define    DEF_PAGESCROLL        (DEF_PAGEOVERLAP+1)
  3027. #define    DEF_REVERSEVIDEO    (DEF_PAGESCROLL+1)
  3028. #define    DEF_REVERSEWRAP        (DEF_REVERSEVIDEO+1)
  3029. #define    DEF_SAVELINES        (DEF_REVERSEWRAP+1)
  3030. #define    DEF_SCROLLBAR        (DEF_SAVELINES+1)
  3031. #define    DEF_SCROLLINPUT        (DEF_SCROLLBAR+1)
  3032. #define    DEF_SCROLLKEY        (DEF_SCROLLINPUT+1)
  3033. #define    DEF_SIGNALINHIBIT    (DEF_SCROLLKEY+1)
  3034. #define    DEF_STATUSLINE        (DEF_SIGNALINHIBIT+1)
  3035. #define    DEF_STATUSNORMAL    (DEF_STATUSLINE+1)
  3036. #define    DEF_TEKICONBITMAP    (DEF_STATUSNORMAL+1)
  3037. #define    DEF_TEKINHIBIT        (DEF_TEKICONBITMAP+1)
  3038. #define    DEF_TEXTUNDERICON    (DEF_TEKINHIBIT+1)
  3039. #define    DEF_TITLEBAR        (DEF_TEXTUNDERICON+1)
  3040. #define    DEF_TITLEFONT        (DEF_TITLEBAR+1)
  3041. #define    DEF_VISUALBELL        (DEF_TITLEFONT+1)
  3042.  
  3043. #define    ARG_132            0
  3044.  
  3045. #ifdef TIOCCONS
  3046. #define    ARG__C            (ARG_132+1)
  3047. #endif TIOCCONS
  3048.  
  3049. #ifdef ARG__C
  3050. #define    ARG__L            (ARG__C+1)
  3051. #else ARG__C
  3052. #define    ARG__L            (ARG_132+1)
  3053. #endif ARG__C
  3054.  
  3055. #define    ARG__S            (ARG__L+1)
  3056. #define    ARG_AI            (ARG__S+1)
  3057. #define    ARG_AR            (ARG_AI+1)
  3058. #define    ARG_B            (ARG_AR+1)
  3059. #define    ARG_BD            (ARG_B+1)
  3060. #define    ARG_BG            (ARG_BD+1)
  3061. #define    ARG_BW            (ARG_BG+1)
  3062. #define    ARG_CR            (ARG_BW+1)
  3063. #define    ARG_CU            (ARG_CR+1)
  3064.  
  3065. #ifdef DEBUG
  3066. #define    ARG_D            (ARG_CU+1)
  3067. #define    ARG_DW            (ARG_D+1)
  3068. #else DEBUG
  3069. #define    ARG_DW            (ARG_CU+1)
  3070. #endif DEBUG
  3071.  
  3072. #define    ARG_E            (ARG_DW+1)
  3073. #define    ARG_FB            (ARG_E+1)
  3074. #define    ARG_FG            (ARG_FB+1)
  3075. #define ARG_FI            (ARG_FG+1)
  3076. #define    ARG_FN            (ARG_FI+1)
  3077. #define    ARG_FT            (ARG_FN+1)
  3078. #define    ARG_I            (ARG_FT+1)
  3079. #define    ARG_IB            (ARG_I+1)
  3080. #define    ARG_IT            (ARG_IB+1)
  3081. #define    ARG_J            (ARG_IT+1)
  3082.  
  3083. #ifdef KEYBD
  3084. #define    ARG_K            (ARG_J+1)
  3085. #define    ARG_L            (ARG_K+1)
  3086. #else KEYBD
  3087. #define    ARG_L            (ARG_J+1)
  3088. #endif KEYBD
  3089.  
  3090. #define    ARG_LF            (ARG_L+1)
  3091. #define    ARG_LS            (ARG_LF+1)
  3092. #define    ARG_MB            (ARG_LS+1)
  3093. #define    ARG_MS            (ARG_MB+1)
  3094. #define    ARG_N            (ARG_MS+1)
  3095. #define    ARG_NB            (ARG_N+1)
  3096. #define    ARG_PO            (ARG_NB+1)
  3097. #define    ARG_PS            (ARG_PO+1)
  3098. #define    ARG_RV            (ARG_PS+1)
  3099. #define    ARG_RW            (ARG_RV+1)
  3100. #define    ARG_S            (ARG_RW+1)
  3101. #define    ARG_SB            (ARG_S+1)
  3102. #define    ARG_SI            (ARG_SB+1)
  3103. #define    ARG_SK            (ARG_SI+1)
  3104. #define    ARG_SL            (ARG_SK+1)
  3105. #define    ARG_SN            (ARG_SL+1)
  3106. #define    ARG_ST            (ARG_SN+1)
  3107. #define    ARG_T            (ARG_ST+1)
  3108. #define    ARG_TB            (ARG_T+1)
  3109. #define    ARG_TI            (ARG_TB+1)
  3110. #define    ARG_VB            (ARG_TI+1)
  3111.  
  3112. #define    DEFBOLDFONT        "vtbold"
  3113. #define    DEFBORDER        1
  3114. #define    DEFBORDERWIDTH        2
  3115. #define    DEFFONT            "vtsingle"
  3116. #define DEFICONFONT        "nil2"
  3117. #define    DEFTITLEFONT        "vtsingle"
  3118. RAZZLE!DAZZLE
  3119. fi    # End main.h
  3120. echo '***** End of' xterm 6.6B - Part 2 of 7 '*****'
  3121. exit
  3122.  
  3123.